Bug 1294171 - Part 1. Treat unresolvable mask as no mask before support image mask. r=mstange
authorcku <cku@mozilla.com>
Thu, 18 Aug 2016 11:24:28 +0800
changeset 309997 23fcd6d28628cc797d6ef905b392c78b93482122
parent 309996 060472436aa5da20b1d347b5c2dac9da6f045bb4
child 309998 dab9f89ca163b8b948a096428405ba25530a31cd
push id30575
push userryanvm@gmail.com
push dateFri, 19 Aug 2016 13:46:06 +0000
treeherdermozilla-central@3da4d64410c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1294171
milestone51.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 1294171 - Part 1. Treat unresolvable mask as no mask before support image mask. r=mstange MozReview-Commit-ID: 9f2k7NtpYuR
layout/svg/nsSVGIntegrationUtils.cpp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -692,27 +692,36 @@ nsSVGIntegrationUtils::PaintFramesWithEf
     nsLayoutUtils::PointToGfxPoint(offsetToUserSpace,
                                    frame->PresContext()->AppUnitsPerDevPixel());
   context.SetMatrix(context.CurrentMatrix().Translate(devPixelOffsetToUserSpace));
 
   gfxMatrix cssPxToDevPxMatrix = GetCSSPxToDevPxMatrix(frame);
 
   const nsStyleSVGReset *svgReset = firstFrame->StyleSVGReset();
   nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();
+
+#ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
   // For a HTML doc:
   //   According to css-masking spec, always create a mask surface when we
   //   have any item in maskFrame even if all of those items are
   //   non-resolvable <mask-sources> or <images>, we still need to create a
   //   transparent black mask layer under this condition.
   // For a SVG doc:
   //   SVG 1.1 say that  if we fail to resolve a mask, we should draw the
   //   object unmasked.
   bool shouldGenerateMaskLayer = hasSVGLayout
                                  ? maskFrames.Length() == 1 && maskFrames[0]
                                  : maskFrames.Length() > 0;
+#else
+  // Since we do not support image mask so far, we should treat any
+  // unresolvable mask as no mask. Otherwise, any object with a valid image
+  // mask, e.g. url("xxx.png"), will become invisible just because we can not
+  // handle image mask correctly. (See bug 1294171)
+  bool shouldGenerateMaskLayer = maskFrames.Length() == 1 && maskFrames[0];
+#endif
 
   // These are used if we require a temporary surface for a custom blend mode.
   RefPtr<gfxContext> target = &aParams.ctx;
   IntPoint targetOffset;
 
   bool complexEffects = false;
   DrawResult result = DrawResult::SUCCESS;
   /* Check if we need to do additional operations on this child's