Bug 1275450 - Part 2. Reftest for unresolvable mask-reference draft
authorcku <cku@mozilla.com>
Mon, 30 May 2016 15:57:43 +0800
changeset 373116 a6be0e646a4be6b400b46bc111e200cf955eaa09
parent 373115 44ebc6a88ab95413bbff8bef18478e4b6bc2c9c4
child 522335 a28779695afb05d71aee6c925095fec27cda170c
push id19690
push usercku@mozilla.com
push dateTue, 31 May 2016 07:55:59 +0000
bugs1275450
milestone49.0a1
Bug 1275450 - Part 2. Reftest for unresolvable mask-reference MozReview-Commit-ID: Je2mJvwBiF7
layout/reftests/w3c-css/submitted/masking/blank.html
layout/reftests/w3c-css/submitted/masking/mask-image-4a.html
layout/reftests/w3c-css/submitted/masking/mask-image-4b.html
layout/reftests/w3c-css/submitted/masking/reftest.list
layout/svg/nsSVGIntegrationUtils.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/masking/blank.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+  <meta charset="utf-8">
+  <title>Blank document</title>
+  <link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
+  <link rel="author" title="Mozilla" href="https://www.mozilla.org">
+<body>
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/masking/mask-image-4a.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>CSS Masking: mask-image: unresovlable mask url</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/#the-mask-image">
+    <link rel="match" href="blank.html">
+    <meta name="assert" content="Test checks non-existent url should be counted as an image layer of transparent black.">
+    <style type="text/css">
+      div {
+        background-color: purple;
+        width: 100px;
+        height: 100px;
+      }
+
+      div.mask-by-png {
+        mask-image: url(non-existent.png);
+      }
+    </style>
+  </head>
+  <body>
+    <div class="mask-by-png"></div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/masking/mask-image-4b.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>CSS Masking: mask-image: unresovlable mask url</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/#the-mask-image">
+    <link rel="match" href="blank.html">
+    <meta name="assert" content="Test checks a mask reference to a none-mask SVG element should be counted as an image layer of transparent black.">
+    <svg height="0">
+      <clipPath id="clip1">
+        <circle cx="50" cy="50" r="25"/>
+      </clipPath>
+    </svg>
+    <style type="text/css">
+      div {
+        background-color: purple;
+        width: 100px;
+        height: 100px;
+      }
+
+      div.mask-by-reference {
+        mask-image: url(#clip1);
+      }
+    </style>
+  </head>
+  <body>
+    <div class="mask-by-reference"></div>
+  </body>
+</html>
--- a/layout/reftests/w3c-css/submitted/masking/reftest.list
+++ b/layout/reftests/w3c-css/submitted/masking/reftest.list
@@ -20,16 +20,18 @@ fails == mask-image-1a.html mask-image-1
 fails == mask-image-1b.html mask-image-1-ref.html
 fails == mask-image-1c.html mask-image-1-ref.html
 fails == mask-image-2.html mask-image-2-ref.html
 fails == mask-image-3a.html mask-image-3-ref.html
 fails == mask-image-3b.html mask-image-3-ref.html
 fails == mask-image-3c.html mask-image-3-ref.html
 fails == mask-image-3d.html mask-image-3-ref.html
 fails == mask-image-3e.html mask-image-3-ref.html
+fails == mask-image-4a.html blank.html
+fails == mask-image-4b.html blank.html
 
 # mask-clip test cases
 fails == mask-clip-1.html mask-clip-1-ref.html
 
 # mask-position test cases
 fails == mask-position-1a.html mask-position-1-ref.html
 fails == mask-position-1b.html mask-position-1-ref.html
 fails == mask-position-1c.html mask-position-1-ref.html
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -439,16 +439,17 @@ GenerateMaskSurface(const nsSVGIntegrati
   gfxRect clipExtents = ctx.GetClipExtents();
   IntRect maskSurfaceRect = RoundedOut(ToRect(clipExtents));
   ctx.Restore();
 
   if (maskSurfaceRect.IsEmpty()) {
     return;
   }
 
+
   // Mask composition result on CoreGraphic::A8 surface is not correct
   // when mask-mode is not add(source over). Switch to skia when CG backend
   // detected.
   RefPtr<DrawTarget> maskDT =
     (ctx.GetDrawTarget()->GetBackendType() == BackendType::COREGRAPHICS)
     ? Factory::CreateDrawTarget(BackendType::SKIA, maskSurfaceRect.Size(),
                                 SurfaceFormat::A8)
     : ctx.GetDrawTarget()->CreateSimilarDrawTarget(maskSurfaceRect.Size(),