Bug 1361180 - Part 1: Return error DrawResult to the caller when the mask url can not be resolved. r=mstange, a=gchang
authorcku <cku@mozilla.com>
Wed, 03 May 2017 10:39:05 +0800
changeset 396243 6922fb2c5500086360753e9d1b3fc975958c82d1
parent 396242 2a2b4755e0821f0a557c661316bef57e2f18cdd0
child 396244 7250535bd34330ab0abddae402e7db21823ecefd
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, gchang
bugs1361180
milestone54.0
Bug 1361180 - Part 1: Return error DrawResult to the caller when the mask url can not be resolved. r=mstange, a=gchang Precondition: In an SVG doc, giving an invalid local-ref mask, e.g. mask="url"#foo"", and clipState.mDirtyRectInDevPx be empty. e.g. apply mask onto a path object which the size of area is zero(Please refers to the reftest in Part 2) 1. PaintStyleImageLayerWithSC early continue at [1], and the value of result is still the initial value, DrawResult::SUCCESS. 2. The caller is not aware of that the mask image was left unresolved since it get DrawResult::SUCCESS from #1. This patch fixed this problem by calling PrepareImageLayer before early return for updating correct drawing result. [1] https://hg.mozilla.org/mozilla-central/file/ebf68ba9b098/layout/painting/nsCSSRendering.cpp#l2682 MozReview-Commit-ID: DjJ0Nni1gDl
layout/painting/nsCSSRendering.cpp
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -3560,28 +3560,32 @@ nsCSSRendering::PaintStyleImageLayerWith
           autoSR.EnsureSaved(ctx);
           ctx->NewPath();
           ctx->SnappedRectangle(clip);
           ctx->Clip();
         }
       }
     }
 
-    // Skip the following layer painting code if we found the dirty region is
-    // empty or the current layer is not selected for drawing.
-    if (clipState.mDirtyRectInDevPx.IsEmpty() ||
-        (aParams.layer >= 0 && i != (uint32_t)aParams.layer)) {
+    // Skip the following layer preparing and painting code if the current
+    // layer is not selected for drawing.
+    if (aParams.layer >= 0 && i != (uint32_t)aParams.layer) {
       continue;
     }
-
     nsBackgroundLayerState state =
       PrepareImageLayer(&aParams.presCtx, aParams.frame,
                         aParams.paintFlags, paintBorderArea,
                         clipState.mBGClipArea, layer, nullptr);
     result &= state.mImageRenderer.PrepareResult();
+
+    // Skip the layer painting code if we found the dirty region is empty.
+    if (clipState.mDirtyRectInDevPx.IsEmpty()) {
+      continue;
+    }
+
     if (!state.mFillArea.IsEmpty()) {
       CompositionOp co = DetermineCompositionOp(aParams, layers, i);
       if (co != CompositionOp::OP_OVER) {
         NS_ASSERTION(ctx->CurrentOp() == CompositionOp::OP_OVER,
                      "It is assumed the initial op is OP_OVER, when it is "
                      "restored later");
         ctx->SetOp(co);
       }