Bug 1346265 - Part 3. Test cases.
Since -moz-element is moz only feature, the test case for -moz-element is
created under reftests/image-element folder.
MozReview-Commit-ID: G4V0G3cX7qr
new file mode 100644
--- /dev/null
+++ b/layout/reftests/image-element/mask-image-element-ref.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style type="text/css">
+ div {
+ background-color: white;
+ position: absolute;
+ margin: 0px;
+ padding: 0px;
+ width: 100px;
+ height: 100px;
+ top: 10px;
+ }
+
+ div.auto {
+ left: 10px;
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect x="0" y="0" width="100%" height="100%" fill="blue" fill-opacity="1"/></svg>');
+ }
+
+ div.alpha {
+ left: 120px;
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect x="0" y="0" width="100%" height="100%" fill="blue" fill-opacity="1"/></svg>');
+ }
+
+ div.luminance1 {
+ left: 230px;
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect x="0" y="0" width="100%" height="100%" fill="rgb(238,238,255)" fill-opacity="1"/></svg>');
+ }
+
+ div.luminance2 {
+ left: 340px;
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect x="0" y="0" width="100%" height="100%" fill="rgb(201,201,255)" fill-opacity="1"/></svg>');
+ }
+
+ div.luminance3 {
+ left: 450px;
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect x="0" y="0" width="100%" height="100%" fill="rgb(73,73,255)" fill-opacity="1"/></svg>');
+ }
+ </style>
+ </head>
+ <body>
+ <div class="auto"></div>
+ <div class="alpha"></div>
+ <div class="luminance1"></div>
+ <div class="luminance2"></div>
+ <div class="luminance3"></div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/image-element/mask-image-element.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style type="text/css">
+ div {
+ background-color: blue;
+ position: absolute;
+ margin: 0px;
+ padding: 0px;
+ width: 100px;
+ height: 100px;
+ top: 10px;
+ }
+
+ div.auto {
+ left: 10px;
+ mask-mode: match-source;
+ mask-image: -moz-element(#blue-bg);
+ }
+
+ div.alpha {
+ left: 120px;
+ mask-mode: alpha;
+ mask-image: -moz-element(#blue-bg);
+ }
+
+ div.luminance1 {
+ left: 230px;
+ mask-mode: luminance;
+ mask-image: -moz-element(#blue-bg);
+ }
+
+ div.luminance2 {
+ left: 340px;
+ mask-mode: luminance;
+ mask-image: -moz-element(#red-bg);
+ }
+
+ div.luminance3 {
+ left: 450px;
+ mask-mode: luminance;
+ mask-image: -moz-element(#lime-bg);
+ }
+ </style>
+ </head>
+ <body>
+ <div class="auto"></div>
+ <div class="alpha"></div>
+ <div class="luminance1"></div>
+ <div class="luminance2"></div>
+ <div class="luminance3"></div>
+
+ <div style="overflow:hidden; height:0;">
+ <div id="blue-bg" style="width:100px; height:100px; background-color: blue;"> </div>
+ </div>
+ <div style="overflow:hidden; height:0;">
+ <div id="red-bg" style="width:100px; height:100px; background-color: red;"></div>
+ </div>
+ <div style="overflow:hidden; height:0;">
+ <div id="lime-bg" style="width:100px; height:100px; background-color: lime;"></div>
+ </div>
+ </body>
+</html>
\ No newline at end of file
--- a/layout/reftests/image-element/reftest.list
+++ b/layout/reftests/image-element/reftest.list
@@ -40,8 +40,10 @@ fuzzy(1,9674) random-if(!cocoaWidget) ==
== gradient-html-06c.html gradient-html-06d.html
== gradient-html-06d.html gradient-html-06e.html
random-if(!cocoaWidget) fuzzy-if(cocoaWidget,2,42305) == gradient-html-07a.html gradient-html-07b.html
fuzzy(1,16900) == gradient-html-07c.html gradient-html-07d.html
HTTP == invalidate-1.html invalidate-1-ref.html
== pattern-html-01.html pattern-html-01-ref.svg
== pattern-html-02.html pattern-html-02-ref.svg
== referenced-from-binding-01.html referenced-from-binding-01-ref.html
+
+fuzzy-if(skiaContent,1,30000) == mask-image-element.html mask-image-element-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/masking/mask-mode-c.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>CSS Masking: mask-mode with raster image</title>
+ <link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
+ <link rel="author" title="Mozilla" href="https://www.mozilla.org">
+ <link rel="help" href="https://www.w3.org/TR/css-masking-1/#propdef-mask-mode">
+ <link rel="match" href="mask-mode-ref.html">
+ <meta name="assert" content="Test checks that mask a PNG image referenced by mask-image is correct with different mask mode.">
+ <style type="text/css">
+ div {
+ background-color: blue;
+ position: absolute;
+ margin: 0px;
+ padding: 0px;
+ width: 100px;
+ height: 100px;
+ top: 10px;
+ }
+
+ div.auto {
+ left: 10px;
+ mask-mode: match-source;
+ mask-image: linear-gradient(blue 0%, blue 100%);
+ }
+
+ div.alpha {
+ left: 120px;
+ mask-mode: alpha;
+ mask-image: linear-gradient(blue 0%, blue 100%);
+ }
+
+ div.luminance1 {
+ left: 230px;
+ mask-mode: luminance;
+ mask-image: linear-gradient(blue 0%, blue 100%);
+ }
+
+ div.luminance2 {
+ left: 340px;
+ mask-mode: luminance;
+ mask-image: linear-gradient(red 0%, red 100%);
+ }
+
+ div.luminance3 {
+ left: 450px;
+ mask-mode: luminance;
+ mask-image: linear-gradient(lime 0%, lime 100%);
+ }
+ </style>
+ </head>
+ <body>
+ <div class="auto"></div>
+ <div class="alpha"></div>
+ <div class="luminance1"></div>
+ <div class="luminance2"></div>
+ <div class="luminance3"></div>
+ </body>
+</html>
\ No newline at end of file
--- a/layout/reftests/w3c-css/submitted/masking/reftest.list
+++ b/layout/reftests/w3c-css/submitted/masking/reftest.list
@@ -6,16 +6,17 @@ fuzzy-if(skiaContent,64,200) == mask-com
== mask-composite-1c.html mask-composite-1-ref.html
fuzzy-if(skiaContent||winWidget,1,5000) == mask-composite-2a.html mask-composite-2-ref.html
fuzzy-if(skiaContent||winWidget,64,5200) == mask-composite-2b.html mask-composite-2-ref.html
== mask-composite-2c.html mask-composite-2-ref.html
# mask-mode test cases
fuzzy-if(skiaContent,1,30000) == mask-mode-a.html mask-mode-ref.html
fuzzy-if(skiaContent,1,30000) == mask-mode-b.html mask-mode-ref.html
+fuzzy-if(skiaContent,1,30000) == mask-mode-c.html mask-mode-ref.html
fuzzy-if(skiaContent,1,30000) == mask-mode-to-mask-type.html mask-mode-to-mask-type-ref.html
# mask-image test cases
== mask-image-1a.html mask-image-1-ref.html
== mask-image-1b.html mask-image-1-ref.html
== mask-image-1c.html mask-image-1-ref.html
== mask-image-1d.html mask-image-1-ref.html
fuzzy-if(skiaContent||winWidget,1,20000) == mask-image-2.html mask-image-2-ref.html