Bug 1347164 - css-color specified style test. r=dholbert
☠☠ backed out by beff3b520fb3 ☠ ☠
authorJerryShih <hshih@mozilla.com>
Thu, 16 Mar 2017 15:29:00 -0400
changeset 348207 bb325d01c4219c4ecf49c2e8830eb762320358ec
parent 348206 18c70bc07c6d26c235f4961a720f1416d2f8daba
child 348208 48f9ab3c59676f9a290e1a08f22e2d0ee945eb98
push id39092
push userkwierso@gmail.com
push dateFri, 17 Mar 2017 18:14:05 +0000
treeherderautoland@88576fd417e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1347164
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1347164 - css-color specified style test. r=dholbert MozReview-Commit-ID: 6RRhz8ftEVO
layout/style/test/test_specified_value_serialization.html
--- a/layout/style/test/test_specified_value_serialization.html
+++ b/layout/style/test/test_specified_value_serialization.html
@@ -62,12 +62,44 @@
                    "font-variant-alternates: SWASH(fOo) stYLIStiC(Bar)");
   is(elt.style.getPropertyValue("font-variant-alternates"),
      "swash(fOo) stylistic(Bar)",
      "expected case canonicalization of transform functions");
 
   elt.setAttribute("style", ""); // leave the page in a useful state
 })();
 
+(function test_bug_1347164() {
+  // Test that specified color values are serialized as "rgb()"
+  // IFF they're fully-opaque (and otherwise as "rgba()").
+  var color = [
+    ["rgba(0, 0, 0, 1)", "rgb(0, 0, 0)"],
+    ["rgba(0, 0, 0, 0.5)", "rgba(0, 0, 0, 0.5)"],
+    ["hsla(0, 0%, 0%, 1)", "rgb(0, 0, 0)"],
+    ["hsla(0, 0%, 0%, 0.5)", "rgba(0, 0, 0, 0.5)"],
+    // css-color-4
+    ["rgba(0 0 0 / 1)", "rgb(0, 0, 0)"],
+    ["rgba(0 0 0 / 0.5)", "rgba(0, 0, 0, 0.5)"],
+    ["rgb(0 0 0 / 1)", "rgb(0, 0, 0)"],
+    ["rgb(0 0 0 / 0.5)", "rgba(0, 0, 0, 0.5)"],
+    ["hsla(0 0% 0% / 1)", "rgb(0, 0, 0)"],
+    ["hsla(0deg 0% 0% / 0.5)", "rgba(0, 0, 0, 0.5)"],
+    ["hsl(0 0% 0% / 1)", "rgb(0, 0, 0)"],
+    ["hsl(0 0% 0% / 0.5)", "rgba(0, 0, 0, 0.5)"],
+  ];
+
+  var frame_container = document.getElementById("display");
+  var p = document.createElement("p");
+  frame_container.appendChild(p);
+
+  for (var i = 0; i < color.length; ++i) {
+    var test = color[i];
+    p.style.color = test[0];
+    is(p.style.color, test[1], "serialization value of " + test[0]);
+  }
+
+  p.remove();
+})();
+
 </script>
 </pre>
 </body>
 </html>