Bug 1361180 - Part 1. Return error DrawResult to the caller when the mask url can not be resolved.
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
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -2670,28 +2670,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);
}