Title: [200888] trunk
Revision
200888
Author
[email protected]
Date
2016-05-13 15:40:52 -0700 (Fri, 13 May 2016)

Log Message

Unprefix -webkit-cross-fade()
https://bugs.webkit.org/show_bug.cgi?id=157632

Reviewed by Darin Adler.
Source/WebCore:

Support unprefixed cross-fade() in addition to the prefixed value when parsing,
and have computed style round-trip the correct one.

If computed style is queried during an image transition, return an unprefixed
cross-fade(). If blending cross-fade values, only return the prefixed function if
both inputs are prefixed.

Tested by modified and existing tests.

* css/CSSCrossfadeValue.cpp:
(WebCore::CSSCrossfadeValue::customCSSText):
(WebCore::CSSCrossfadeValue::blend):
* css/CSSCrossfadeValue.h:
(WebCore::CSSCrossfadeValue::create):
(WebCore::CSSCrossfadeValue::isPrefixed):
(WebCore::CSSCrossfadeValue::CSSCrossfadeValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::isGeneratedImageValue):
(WebCore::CSSParser::parseGeneratedImage):
(WebCore::CSSParser::parseCrossfade):
* css/CSSParser.h:

Source/WebInspectorUI:

* UserInterface/Models/CSSKeywordCompletions.js:

LayoutTests:

* animations/cross-fade-background-image-expected.html:
* animations/cross-fade-background-image.html:
* animations/cross-fade-border-image-source.html:
* animations/cross-fade-list-style-image.html:
* animations/cross-fade-webkit-mask-box-image.html:
* animations/cross-fade-webkit-mask-image.html:
* animations/resources/animation-test-helpers.js:
(parseCSSImage):
(parseCrossFade):
(compareCSSImages):
* fast/css/getComputedStyle/computed-style-cross-fade-expected.txt:
* fast/css/getComputedStyle/computed-style-cross-fade.html:
* transitions/resources/transition-test-helpers.js:
(parseCrossFade):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200887 => 200888)


--- trunk/LayoutTests/ChangeLog	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/ChangeLog	2016-05-13 22:40:52 UTC (rev 200888)
@@ -1,3 +1,25 @@
+2016-05-13  Simon Fraser  <[email protected]>
+
+        Unprefix -webkit-cross-fade()
+        https://bugs.webkit.org/show_bug.cgi?id=157632
+
+        Reviewed by Darin Adler.
+        
+        * animations/cross-fade-background-image-expected.html:
+        * animations/cross-fade-background-image.html:
+        * animations/cross-fade-border-image-source.html:
+        * animations/cross-fade-list-style-image.html:
+        * animations/cross-fade-webkit-mask-box-image.html:
+        * animations/cross-fade-webkit-mask-image.html:
+        * animations/resources/animation-test-helpers.js:
+        (parseCSSImage):
+        (parseCrossFade):
+        (compareCSSImages):
+        * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt:
+        * fast/css/getComputedStyle/computed-style-cross-fade.html:
+        * transitions/resources/transition-test-helpers.js:
+        (parseCrossFade):
+
 2016-05-13  Yoav Weiss  <[email protected]>
 
         ResourceTiming entries for cached resources and XHR

Modified: trunk/LayoutTests/animations/cross-fade-background-image-expected.html (200887 => 200888)


--- trunk/LayoutTests/animations/cross-fade-background-image-expected.html	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/animations/cross-fade-background-image-expected.html	2016-05-13 22:40:52 UTC (rev 200888)
@@ -14,12 +14,12 @@
 <body>
 <div id="rect"></div>
 <div id="result">
-PASS - "backgroundImage" property for "box" element at 2.5s saw something close to: -webkit-cross-fade(url(blue-100.png), url(green-100.png), 50%)<br>
+PASS - "backgroundImage" property for "box" element at 2.5s saw something close to: cross-fade(url(blue-100.png), url(green-100.png), 50%)<br>
 PASS - "backgroundImage" property for "box" and "boxStatic" elements at 2.5s are close enough to each other<br>
 PASS - "backgroundImage" property for "boxShorthand" and "boxStatic" elements at 2.5s are close enough to each other<br>
-PASS - "backgroundImage" property for "boxAnim1" element at 2.5s saw something close to: -webkit-cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 0.5)<br>
-PASS - "backgroundImage" property for "boxAnim2" element at 2.5s saw something close to: -webkit-cross-fade(url(resources/green-100.png), url(resources/blue-100.png), 50%)<br>
-PASS - "backgroundImage" property for "boxAnim3" element at 2.5s saw something close to: -webkit-cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 50%)<br>
+PASS - "backgroundImage" property for "boxAnim1" element at 2.5s saw something close to: cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 0.5)<br>
+PASS - "backgroundImage" property for "boxAnim2" element at 2.5s saw something close to: cross-fade(url(resources/green-100.png), url(resources/blue-100.png), 50%)<br>
+PASS - "backgroundImage" property for "boxAnim3" element at 2.5s saw something close to: cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 50%)<br>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: trunk/LayoutTests/animations/cross-fade-background-image.html (200887 => 200888)


--- trunk/LayoutTests/animations/cross-fade-background-image.html	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/animations/cross-fade-background-image.html	2016-05-13 22:40:52 UTC (rev 200888)
@@ -70,7 +70,7 @@
     @-webkit-keyframes animCross2 {
         /* Image inputs are not identical - no animation.*/
         from { background-image: -webkit-cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 20%); }
-        to   { background-image: -webkit-cross-fade(url(resources/green-100.png), url(resources/blue-100.png), 50%); }
+        to   { background-image: cross-fade(url(resources/green-100.png), url(resources/blue-100.png), 50%); }
     }
     @-webkit-keyframes animCross3 {
         /* Direct image inputs are not identical - no animation.*/
@@ -82,12 +82,12 @@
   <script type="text/_javascript_" charset="utf-8">
     const expectedValues = [
       // [animation-name, time, element-id, property, expected-value, tolerance]
-      ["anim", 2.5, "box", "backgroundImage", "-webkit-cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
-      ["anim", 2.5, ["box", "static:boxStatic"], "backgroundImage", "-webkit-cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
-      ["animShorthand", 2.5, ["boxShorthand", "static:boxStatic"], "backgroundImage", "-webkit-cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
-      ["animCross1", 2.5, "boxAnim1", "backgroundImage", "-webkit-cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 0.5)", 0.05],
-      ["animCross2", 2.5, "boxAnim2", "backgroundImage", "-webkit-cross-fade(url(resources/green-100.png), url(resources/blue-100.png), 50%)", 0],
-      ["animCross3", 2.5, "boxAnim3", "backgroundImage", "-webkit-cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 50%)", 0],
+      ["anim", 2.5, "box", "backgroundImage", "cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
+      ["anim", 2.5, ["box", "static:boxStatic"], "backgroundImage", "cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
+      ["animShorthand", 2.5, ["boxShorthand", "static:boxStatic"], "backgroundImage", "cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
+      ["animCross1", 2.5, "boxAnim1", "backgroundImage", "cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 0.5)", 0.05],
+      ["animCross2", 2.5, "boxAnim2", "backgroundImage", "cross-fade(url(resources/green-100.png), url(resources/blue-100.png), 50%)", 0],
+      ["animCross3", 2.5, "boxAnim3", "backgroundImage", "cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 50%)", 0],
     ];
 
     var doPixelTest = true;

Modified: trunk/LayoutTests/animations/cross-fade-border-image-source.html (200887 => 200888)


--- trunk/LayoutTests/animations/cross-fade-border-image-source.html	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/animations/cross-fade-border-image-source.html	2016-05-13 22:40:52 UTC (rev 200888)
@@ -44,8 +44,8 @@
       // [animation-name, time, element-id, property, expected-value, tolerance]
       // FIXME: We can't test reading the borderImage shorthand because of bug #13658.
       ["anim", 2.5, "box", "borderImageSource", "-webkit-cross-fade(url(stripes-100.png), url(green-100.png), 0.5)", 0.05],
-      ["anim", 2.5, ["box", "static:boxStatic"], "borderImageSource", "-webkit-cross-fade(url(stripes-100.png), url(green-100.png), 50%)", 0.05],
-      ["animShorthand", 2.5, ["boxShorthand", "static:boxStatic"], "borderImageSource", "-webkit-cross-fade(url(stripes-100), url(green-100.png), 50%)", 0.05],
+      ["anim", 2.5, ["box", "static:boxStatic"], "borderImageSource", "cross-fade(url(stripes-100.png), url(green-100.png), 50%)", 0.05],
+      ["animShorthand", 2.5, ["boxShorthand", "static:boxStatic"], "borderImageSource", "cross-fade(url(stripes-100), url(green-100.png), 50%)", 0.05],
     ];
 
     var doPixelTest = true;

Modified: trunk/LayoutTests/animations/cross-fade-list-style-image.html (200887 => 200888)


--- trunk/LayoutTests/animations/cross-fade-list-style-image.html	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/animations/cross-fade-list-style-image.html	2016-05-13 22:40:52 UTC (rev 200888)
@@ -39,8 +39,8 @@
     const expectedValues = [
       // [animation-name, time, element-id, property, expected-value, tolerance]
       ["anim", 2.5, "box", "listStyleImage", "-webkit-cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
-      ["anim", 2.5, ["box", "static:boxStatic"], "listStyleImage", "-webkit-cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
-      ["animShorthand", 2.5, ["boxShorthand", "static:boxStatic"], "listStyleImage", "-webkit-cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
+      ["anim", 2.5, ["box", "static:boxStatic"], "listStyleImage", "cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
+      ["animShorthand", 2.5, ["boxShorthand", "static:boxStatic"], "listStyleImage", "cross-fade(url(blue-100.png), url(green-100.png), 50%)", 0.05],
     ];
 
     var doPixelTest = true;

Modified: trunk/LayoutTests/animations/cross-fade-webkit-mask-box-image.html (200887 => 200888)


--- trunk/LayoutTests/animations/cross-fade-webkit-mask-box-image.html	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/animations/cross-fade-webkit-mask-box-image.html	2016-05-13 22:40:52 UTC (rev 200888)
@@ -29,7 +29,7 @@
     const expectedValues = [
       // [animation-name, time, element-id, property, expected-value, tolerance]
       ["anim", 2.25, "box", "webkitMaskBoxImage", "-webkit-cross-fade(url(stripes-100.png), url(green-100.png), 25%)", 0.05],
-      ["anim", 2.25, ["box", "static:boxStatic"], "webkitMaskBoxImage", "-webkit-cross-fade(url(stripes-100.png), url(green-100.png), 25%)", 0.05]
+      ["anim", 2.25, ["box", "static:boxStatic"], "webkitMaskBoxImage", "cross-fade(url(stripes-100.png), url(green-100.png), 25%)", 0.05]
     ];
 
     var doPixelTest = true;

Modified: trunk/LayoutTests/animations/cross-fade-webkit-mask-image.html (200887 => 200888)


--- trunk/LayoutTests/animations/cross-fade-webkit-mask-image.html	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/animations/cross-fade-webkit-mask-image.html	2016-05-13 22:40:52 UTC (rev 200888)
@@ -28,7 +28,7 @@
   <script type="text/_javascript_" charset="utf-8">
     const expectedValues = [
       // [animation-name, time, element-id, property, expected-value, tolerance]
-      ["anim", 2.25, "box", "webkitMaskImage", "-webkit-cross-fade(url(stripes-100.png), url(green-100.png), 25%)", 0.05],
+      ["anim", 2.25, "box", "webkitMaskImage", "cross-fade(url(stripes-100.png), url(green-100.png), 25%)", 0.05],
       ["anim", 2.25, ["box", "static:boxStatic"], "webkitMaskImage", "-webkit-cross-fade(url(stripes-100.png), url(green-100.png), 25%)", 0.05]
     ];
 

Modified: trunk/LayoutTests/animations/resources/animation-test-helpers.js (200887 => 200888)


--- trunk/LayoutTests/animations/resources/animation-test-helpers.js	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/animations/resources/animation-test-helpers.js	2016-05-13 22:40:52 UTC (rev 200888)
@@ -72,6 +72,7 @@
     switch (functionName) {
     case "filter":
         return parseFilterImage(functionValue);
+    case "cross-fade":
     case "-webkit-cross-fade":
         return parseCrossFade(functionValue);
     case "url":
@@ -88,14 +89,14 @@
 {
     var matches = s.match("(.*)\\s*,\\s*(.*)\\s*,\\s*(.*)\\s*");
     if (!matches) {
-        console.error("Parsing error on '-webkit-cross-fade()'.");
+        console.error("Parsing error on 'cross-fade()'.");
         return null;
     }
 
     var from = parseCSSImage(matches[1]);
     var to = parseCSSImage(matches[2]);
     if (!from || !to) {
-        console.error("Parsing error on images passed to '-webkit-cross-fade()' ", s);
+        console.error("Parsing error on images passed to 'cross-fade()' ", s);
         return null;
     }
 
@@ -105,19 +106,19 @@
         // Check if last char is '%' and rip it off.
         // Normalize it to number.
         if (fadeValue.search('%') != fadeValue.length - 1) {
-            console.error("Passed value to '-webkit-cross-fade()' is not a number or percentage ", fadeValue);
+            console.error("Passed value to 'cross-fade()' is not a number or percentage ", fadeValue);
             return null;
         }
         fadeValue = fadeValue.slice(0, fadeValue.length - 1);
         if (isNaN(fadeValue)) {
-            console.error("Passed value to '-webkit-cross-fade()' is not a number or percentage ", fadeValue);
+            console.error("Passed value to 'cross-fade()' is not a number or percentage ", fadeValue);
             return null;
         }
         percent = parseFloat(fadeValue) / 100;
     } else
         percent = parseFloat(fadeValue);
 
-    return ["-webkit-cross-fade", from, to, percent];
+    return ["cross-fade", from, to, percent];
 }
 
 // This should just be called by parseCSSImage.
@@ -244,6 +245,7 @@
     case "-webkit-filter":
         return compareCSSImages(actual[1], expected[1], tolerance)
             && compareFilterFunctions(actual[2], expected[2], tolerance);
+    case "cross-fade":
     case "-webkit-cross-fade":
         return compareCSSImages(actual[1], expected[1], tolerance)
             && compareCSSImages(actual[2], expected[2], tolerance)

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-cross-fade-expected.txt (200887 => 200888)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-cross-fade-expected.txt	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-cross-fade-expected.txt	2016-05-13 22:40:52 UTC (rev 200888)
@@ -1,7 +1,8 @@
--webkit-cross-fade
+cross-fade
 
 
 PASS testCrossfade("opacity: 500%", "opacity") is "1"
+Prefixed
 PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 50%)", "background-image") is "-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 0.5)"
 PASS testCrossfade("background-image: -webkit-cross-fade(-webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), url(dummy://example.png), 50%)", "background-image") is "-webkit-cross-fade(-webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), url(dummy://example.png), 0.5)"
 PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://c.png), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), 50%)", "background-image") is "-webkit-cross-fade(url(dummy://c.png), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), 0.5)"
@@ -11,18 +12,34 @@
 PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 5.0)", "background-image") is "-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 1)"
 PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 700%)", "background-image") is "-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 1)"
 PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), -20)", "background-image") is "-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 0)"
+Unprefixed
+
+
+PASS testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png), 50%)", "background-image") is "cross-fade(url(dummy://example.png), url(dummy://example.png), 0.5)"
+PASS testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png), 1.0)", "background-image") is "cross-fade(url(dummy://example.png), url(dummy://example.png), 1)"
+Mixed
+
+
+PASS testCrossfade("background-image: -webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), url(dummy://example.png), 50%)", "background-image") is "-webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), url(dummy://example.png), 0.5)"
+PASS testCrossfade("background-image: -webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), 50%)", "background-image") is "-webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), 0.5)"
+PASS testCrossfade("background-image: cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), 50%)", "background-image") is "cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), 0.5)"
+Invalid values
+
+
 PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png))", "background-image") is "none"
 PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png),)", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png))", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(), url(dummy://example.png))", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(url(", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(10px 20% 5px #bbb)", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(-webkit-cross-fade(-webkit-cross-fade()))", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(20%, url(dummy://a.png), url(dummy://b.png))", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(url(dummy://a.png),)", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(,)", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(,url(dummy://a.png))", "background-image") is "none"
-PASS testCrossfade("background-image: -webkit-cross-fade(,,,,,)", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png))", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png),)", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(url(dummy://example.png))", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(), url(dummy://example.png))", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(url(", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(10px 20% 5px #bbb)", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(cross-fade(cross-fade()))", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(20%, url(dummy://a.png), url(dummy://b.png))", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(url(dummy://a.png),)", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(,)", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(,url(dummy://a.png))", "background-image") is "none"
+PASS testCrossfade("background-image: cross-fade(,,,,,)", "background-image") is "none"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-cross-fade.html (200887 => 200888)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-cross-fade.html	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-cross-fade.html	2016-05-13 22:40:52 UTC (rev 200888)
@@ -17,14 +17,18 @@
     return result;
 }
 
-debug('<p>-webkit-cross-fade</p>');
+debug('<h2>cross-fade</h2>');
 
 // Valid
 
 shouldBe('testCrossfade("opacity: 500%", "opacity")', '"1"');
+
+debug('Prefixed');
+
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 50%)", "background-image")', '"-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 0.5)"');
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(-webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), url(dummy://example.png), 50%)", "background-image")', '"-webkit-cross-fade(-webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), url(dummy://example.png), 0.5)"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://c.png), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), 50%)", "background-image")', '"-webkit-cross-fade(url(dummy://c.png), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), 0.5)"');
+shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://c.png), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), 50%)", "background-image")',
+    '"-webkit-cross-fade(url(dummy://c.png), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), 0.5)"');
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(-webkit-linear-gradient(black, white), url(dummy://example.png), 10%)", "background-image")', '"-webkit-cross-fade(-webkit-linear-gradient(top, black, white), url(dummy://example.png), 0.1)"');
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 1.0)", "background-image")', '"-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 1)"');
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 0.5)", "background-image")', '"-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 0.5)"');
@@ -34,22 +38,39 @@
 
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), -20)", "background-image")', '"-webkit-cross-fade(url(dummy://example.png), url(dummy://example.png), 0)"');
 
-// Invalid
+debug('<h2>Unprefixed</h2>');
 
+shouldBe('testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png), 50%)", "background-image")', '"cross-fade(url(dummy://example.png), url(dummy://example.png), 0.5)"');
+shouldBe('testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png), 1.0)", "background-image")', '"cross-fade(url(dummy://example.png), url(dummy://example.png), 1)"');
+
+debug('<h2>Mixed</h2>');
+
+shouldBe('testCrossfade("background-image: -webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), url(dummy://example.png), 50%)", "background-image")',
+    '"-webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), url(dummy://example.png), 0.5)"');
+shouldBe('testCrossfade("background-image: -webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), 50%)", "background-image")',
+    '"-webkit-cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), 0.5)"');
+shouldBe('testCrossfade("background-image: cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 25%), 50%)", "background-image")',
+        '"cross-fade(cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), -webkit-cross-fade(url(dummy://a.png), url(dummy://b.png), 0.25), 0.5)"');
+
+debug('<h2>Invalid values</h2>');
+
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png))", "background-image")', '"none"');
 shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png), url(dummy://example.png),)", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://example.png))", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(), url(dummy://example.png))", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(10px 20% 5px #bbb)", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(-webkit-cross-fade(-webkit-cross-fade()))", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(20%, url(dummy://a.png), url(dummy://b.png))", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(url(dummy://a.png),)", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(,)", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(,url(dummy://a.png))", "background-image")', '"none"');
-shouldBe('testCrossfade("background-image: -webkit-cross-fade(,,,,,)", "background-image")', '"none"');
 
+shouldBe('testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png))", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(url(dummy://example.png), url(dummy://example.png),)", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(url(dummy://example.png))", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(), url(dummy://example.png))", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(url(", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(10px 20% 5px #bbb)", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(cross-fade(cross-fade()))", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(20%, url(dummy://a.png), url(dummy://b.png))", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(url(dummy://a.png),)", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(,)", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(,url(dummy://a.png))", "background-image")', '"none"');
+shouldBe('testCrossfade("background-image: cross-fade(,,,,,)", "background-image")', '"none"');
 
+
 </script>
 
 <script src=""

Modified: trunk/LayoutTests/transitions/resources/transition-test-helpers.js (200887 => 200888)


--- trunk/LayoutTests/transitions/resources/transition-test-helpers.js	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/LayoutTests/transitions/resources/transition-test-helpers.js	2016-05-13 22:40:52 UTC (rev 200888)
@@ -61,7 +61,7 @@
 
 function parseCrossFade(s)
 {
-    var matches = s.match("-webkit-cross-fade\\((.*)\\s*,\\s*(.*)\\s*,\\s*(.*)\\)");
+    var matches = s.match("(?:-webkit-)?cross-fade\\((.*)\\s*,\\s*(.*)\\s*,\\s*(.*)\\)");
 
     if (!matches)
         return null;

Modified: trunk/Source/WebCore/ChangeLog (200887 => 200888)


--- trunk/Source/WebCore/ChangeLog	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/Source/WebCore/ChangeLog	2016-05-13 22:40:52 UTC (rev 200888)
@@ -1,3 +1,32 @@
+2016-05-13  Simon Fraser  <[email protected]>
+
+        Unprefix -webkit-cross-fade()
+        https://bugs.webkit.org/show_bug.cgi?id=157632
+
+        Reviewed by Darin Adler.
+
+        Support unprefixed cross-fade() in addition to the prefixed value when parsing,
+        and have computed style round-trip the correct one.
+
+        If computed style is queried during an image transition, return an unprefixed
+        cross-fade(). If blending cross-fade values, only return the prefixed function if
+        both inputs are prefixed.
+
+        Tested by modified and existing tests.
+
+        * css/CSSCrossfadeValue.cpp:
+        (WebCore::CSSCrossfadeValue::customCSSText):
+        (WebCore::CSSCrossfadeValue::blend):
+        * css/CSSCrossfadeValue.h:
+        (WebCore::CSSCrossfadeValue::create):
+        (WebCore::CSSCrossfadeValue::isPrefixed):
+        (WebCore::CSSCrossfadeValue::CSSCrossfadeValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::isGeneratedImageValue):
+        (WebCore::CSSParser::parseGeneratedImage):
+        (WebCore::CSSParser::parseCrossfade):
+        * css/CSSParser.h:
+
 2016-05-13  Yoav Weiss  <[email protected]>
 
         ResourceTiming entries for cached resources and XHR

Modified: trunk/Source/WebCore/css/CSSCrossfadeValue.cpp (200887 => 200888)


--- trunk/Source/WebCore/css/CSSCrossfadeValue.cpp	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/Source/WebCore/css/CSSCrossfadeValue.cpp	2016-05-13 22:40:52 UTC (rev 200888)
@@ -69,7 +69,10 @@
 String CSSCrossfadeValue::customCSSText() const
 {
     StringBuilder result;
-    result.appendLiteral("-webkit-cross-fade(");
+    if (m_isPrefixed)
+        result.appendLiteral("-webkit-cross-fade(");
+    else
+        result.appendLiteral("cross-fade(");
     result.append(m_fromValue->cssText());
     result.appendLiteral(", ");
     result.append(m_toValue->cssText());
@@ -202,7 +205,7 @@
     auto fromImageValue = CSSImageValue::create(m_cachedFromImage->url(), fromStyledImage.get());
     auto toImageValue = CSSImageValue::create(m_cachedToImage->url(), toStyledImage.get());
 
-    RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(WTFMove(fromImageValue), WTFMove(toImageValue));
+    RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(WTFMove(fromImageValue), WTFMove(toImageValue), from.isPrefixed() && isPrefixed());
 
     double fromPercentage = from.m_percentageValue->getDoubleValue();
     if (from.m_percentageValue->isPercentage())

Modified: trunk/Source/WebCore/css/CSSCrossfadeValue.h (200887 => 200888)


--- trunk/Source/WebCore/css/CSSCrossfadeValue.h	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/Source/WebCore/css/CSSCrossfadeValue.h	2016-05-13 22:40:52 UTC (rev 200888)
@@ -43,9 +43,9 @@
 class CSSCrossfadeValue : public CSSImageGeneratorValue {
     friend class CrossfadeSubimageObserverProxy;
 public:
-    static Ref<CSSCrossfadeValue> create(PassRefPtr<CSSValue> fromValue, PassRefPtr<CSSValue> toValue)
+    static Ref<CSSCrossfadeValue> create(PassRefPtr<CSSValue> fromValue, PassRefPtr<CSSValue> toValue, bool prefixed = false)
     {
-        return adoptRef(*new CSSCrossfadeValue(fromValue, toValue));
+        return adoptRef(*new CSSCrossfadeValue(fromValue, toValue, prefixed));
     }
 
     ~CSSCrossfadeValue();
@@ -56,6 +56,7 @@
     bool isFixedSize() const { return true; }
     FloatSize fixedSize(const RenderElement*);
 
+    bool isPrefixed() const { return m_isPrefixed; }
     bool isPending() const;
     bool knownToBeOpaque(const RenderElement*) const;
 
@@ -72,11 +73,12 @@
     bool equalInputImages(const CSSCrossfadeValue&) const;
 
 private:
-    CSSCrossfadeValue(PassRefPtr<CSSValue> fromValue, PassRefPtr<CSSValue> toValue)
+    CSSCrossfadeValue(PassRefPtr<CSSValue> fromValue, PassRefPtr<CSSValue> toValue, bool prefixed)
         : CSSImageGeneratorValue(CrossfadeClass)
         , m_fromValue(fromValue)
         , m_toValue(toValue)
         , m_crossfadeSubimageObserver(this)
+        , m_isPrefixed(prefixed)
     {
     }
 
@@ -108,6 +110,7 @@
     RefPtr<Image> m_generatedImage;
 
     CrossfadeSubimageObserverProxy m_crossfadeSubimageObserver;
+    bool m_isPrefixed { false };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/CSSParser.cpp (200887 => 200888)


--- trunk/Source/WebCore/css/CSSParser.cpp	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2016-05-13 22:40:52 UTC (rev 200888)
@@ -4538,6 +4538,7 @@
 
     valueList.next();
 }
+
 void CSSParser::parse3ValuesFillPosition(CSSParserValueList& valueList, RefPtr<CSSPrimitiveValue>& value1, RefPtr<CSSPrimitiveValue>& value2, RefPtr<CSSPrimitiveValue>&& parsedValue1, RefPtr<CSSPrimitiveValue>&& parsedValue2)
 {
     unsigned cumulativeFlags = 0;
@@ -9451,6 +9452,7 @@
         || equalLettersIgnoringASCIICase(value.function->name, "-webkit-repeating-radial-gradient(")
         || equalLettersIgnoringASCIICase(value.function->name, "repeating-radial-gradient(")
         || equalLettersIgnoringASCIICase(value.function->name, "-webkit-canvas(")
+        || equalLettersIgnoringASCIICase(value.function->name, "cross-fade(")
         || equalLettersIgnoringASCIICase(value.function->name, "-webkit-cross-fade(")
         || equalLettersIgnoringASCIICase(value.function->name, "filter(")
         || equalLettersIgnoringASCIICase(value.function->name, "-webkit-filter(")
@@ -9495,8 +9497,11 @@
         return parseCanvas(valueList, value);
 
     if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-cross-fade("))
-        return parseCrossfade(valueList, value);
+        return parseCrossfade(valueList, value, true);
 
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "cross-fade("))
+        return parseCrossfade(valueList, value, false);
+
     if (equalLettersIgnoringASCIICase(parserValue.function->name, "filter(") || equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-filter("))
         return parseFilterImage(valueList, value);
 
@@ -9547,7 +9552,7 @@
     return true;
 }
 
-bool CSSParser::parseCrossfade(CSSParserValueList& valueList, RefPtr<CSSValue>& crossfade)
+bool CSSParser::parseCrossfade(CSSParserValueList& valueList, RefPtr<CSSValue>& crossfade, bool prefixed)
 {
     RefPtr<CSSCrossfadeValue> result;
 
@@ -9591,7 +9596,7 @@
     else
         return false;
 
-    result = CSSCrossfadeValue::create(fromImageValue, toImageValue);
+    result = CSSCrossfadeValue::create(fromImageValue, toImageValue, prefixed);
     result->setPercentage(percentage);
 
     crossfade = result;

Modified: trunk/Source/WebCore/css/CSSParser.h (200887 => 200888)


--- trunk/Source/WebCore/css/CSSParser.h	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/Source/WebCore/css/CSSParser.h	2016-05-13 22:40:52 UTC (rev 200888)
@@ -304,7 +304,7 @@
     bool parseRadialGradient(CSSParserValueList&, RefPtr<CSSValue>&, CSSGradientRepeat repeating);
     bool parseGradientColorStops(CSSParserValueList&, CSSGradientValue&, bool expectComma);
 
-    bool parseCrossfade(CSSParserValueList&, RefPtr<CSSValue>&);
+    bool parseCrossfade(CSSParserValueList&, RefPtr<CSSValue>&, bool prefixed);
 
 #if ENABLE(CSS_IMAGE_RESOLUTION)
     RefPtr<CSSValue> parseImageResolution();

Modified: trunk/Source/WebInspectorUI/ChangeLog (200887 => 200888)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-05-13 22:40:52 UTC (rev 200888)
@@ -1,3 +1,12 @@
+2016-05-13  Simon Fraser  <[email protected]>
+
+        Unprefix -webkit-cross-fade()
+        https://bugs.webkit.org/show_bug.cgi?id=157632
+
+        Reviewed by Darin Adler.
+
+        * UserInterface/Models/CSSKeywordCompletions.js:
+
 2016-05-13  Matt Baker  <[email protected]>
 
         Web Inspector: Typing "layout" in filter for Layout and Rendering Timeline matches everything

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js (200887 => 200888)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js	2016-05-13 22:34:29 UTC (rev 200887)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js	2016-05-13 22:40:52 UTC (rev 200888)
@@ -162,10 +162,10 @@
         "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
     ],
     "content": [
-        "list-item", "close-quote", "no-close-quote", "no-open-quote", "open-quote", "attr()", "counter()", "counters()", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "-webkit-cross-fade()", "-webkit-image-set()"
+        "list-item", "close-quote", "no-close-quote", "no-open-quote", "open-quote", "attr()", "counter()", "counters()", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "cross-fade()", "-webkit-image-set()"
     ],
     "list-style-image": [
-        "none", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "-webkit-cross-fade()", "-webkit-image-set()"
+        "none", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "cross-fade()", "-webkit-image-set()"
     ],
     "clear": [
         "none", "left", "right", "both"
@@ -243,7 +243,7 @@
         "a3", "a4", "a5", "b4", "b5", "landscape", "ledger", "legal", "letter", "portrait"
     ],
     "background": [
-        "none", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "-webkit-cross-fade()", "-webkit-image-set()",
+        "none", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "cross-fade()", "-webkit-image-set()",
         "repeat", "repeat-x", "repeat-y", "no-repeat", "space", "round",
         "scroll", "fixed", "local",
         "auto", "contain", "cover",
@@ -251,7 +251,7 @@
         "border-box", "padding-box", "content-box"
     ],
     "background-image": [
-        "none", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "-webkit-cross-fade()", "-webkit-image-set()"
+        "none", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "cross-fade()", "-webkit-image-set()"
     ],
     "background-size": [
         "auto", "contain", "cover"
@@ -474,7 +474,7 @@
         "none", "auto", "manual"
     ],
     "border-image": [
-        "repeat", "stretch", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "-webkit-cross-fade()", "-webkit-image-set()"
+        "repeat", "stretch", "url()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "-webkit-canvas()", "cross-fade()", "-webkit-image-set()"
     ],
     "border-image-repeat": [
         "repeat", "stretch", "space", "round"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to