Bug 1467621 - P4: Fix distance for drop-shadow with currentcolor. r?hiro draft
authorDan Glastonbury <dan.glastonbury@gmail.com>
Fri, 22 Jun 2018 11:17:04 +1000
changeset 810060 5a06adfd488553b360109699d0ccf1d22c8ceca3
parent 810059 57fa579aa82adeff8c517c84db5d630ba3312cf4
push id113874
push userbmo:dglastonbury@mozilla.com
push dateMon, 25 Jun 2018 04:15:24 +0000
reviewershiro
bugs1467621
milestone62.0a1
Bug 1467621 - P4: Fix distance for drop-shadow with currentcolor. r?hiro MozReview-Commit-ID: 9L9rkPAROqG
dom/animation/test/mozilla/test_distance_of_filter.html
--- a/dom/animation/test/mozilla/test_distance_of_filter.html
+++ b/dom/animation/test/mozilla/test_distance_of_filter.html
@@ -85,17 +85,23 @@ test(function(t) {
                 filter1 + ' and ' + filter2);
 }, 'drop-shadows');
 
 test(function(t) {
   var target = addDiv(t);
   var filter1 = 'drop-shadow(10px 10px 10px)';
   var filter2 = 'drop-shadow(5px 5px 1px yellow)';
   var dist = getDistance(target, 'filter', filter1, filter2);
-  assert_equals(dist, 0, filter1 + ' and ' + filter2);
+  // Yellow:      rgba(255, 255, 0, 1.0) = rgba(100%, 100%,   0%, 100%)
+  // Transparent: rgba(0, 0, 0, 0)       = rgba(  0%,   0%,   0%,   0%)
+  // Distance involving `currentcolor` is calculated as distance
+  //   from `transparent` + 1
+  assert_equals(dist,
+                Math.sqrt(5 * 5 * 2 + 9 * 9 + (1 * 1 * 3 + 1)),
+                filter1 + ' and ' + filter2);
 }, 'drop-shadows with color and non-color');
 
 test(function(t) {
   var target = addDiv(t);
   var dist = getDistance(target, 'filter', 'grayscale(25%)', 'none');
   // The default value of grayscale is 0%.
   assert_equals(dist, 0.25, 'grayscale(25%) and none');
 }, 'grayscale and none');