Backed out changeset 3eb7e82deef8 (bug 1251115) for android mask-composite-1b.html failures

MozReview-Commit-ID: HsTW97D6aSa
This commit is contained in:
Wes Kocher 2016-02-26 10:06:22 -08:00
parent 82b06ed14d
commit a121514dce

View File

@ -515,28 +515,18 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
// This source is not a svg mask, but it still can be a correct mask image.
nsSVGMaskFrame *svgMaskFrame = effectProperties.GetMaskFrame(&isOK);
bool complexEffects = false;
bool hasValidLayers = svgReset->mMask.HasLayerWithImage();
// These are used if we require a temporary surface for a custom blend mode.
RefPtr<gfxContext> target = &aContext;
IntPoint targetOffset;
// hasMaskToDraw is true means we have at least one drawable mask resource.
// We need to apply mask only if hasMaskToDraw is true.
bool hasMaskToDraw = (svgMaskFrame != nullptr);
if (!hasMaskToDraw) {
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, svgReset->mMask) {
if (svgReset->mMask.mLayers[i].mImage.IsLoaded()) {
hasMaskToDraw = true;
break;
}
}
}
bool complexEffects = false;
/* Check if we need to do additional operations on this child's
* rendering, which necessitates rendering into another surface. */
if (opacity != 1.0f || (clipPathFrame && !isTrivialClip)
|| aFrame->StyleDisplay()->mMixBlendMode != NS_STYLE_BLEND_NORMAL
|| hasMaskToDraw) {
|| svgMaskFrame || hasValidLayers) {
complexEffects = true;
aContext.Save();
@ -549,14 +539,12 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
Matrix maskTransform;
RefPtr<SourceSurface> maskSurface;
if (svgMaskFrame) {
// Generate maskSurface from a SVG mask.
maskSurface = svgMaskFrame->GetMaskForMaskedFrame(&aContext,
aFrame,
cssPxToDevPxMatrix,
opacity,
&maskTransform);
} else if (hasMaskToDraw) {
// Create maskSuface.
} else if (hasValidLayers) {
gfxRect clipRect = aContext.GetClipExtents();
{
gfxContextMatrixAutoSaveRestore matRestore(&aContext);
@ -574,7 +562,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
RefPtr<gfxContext> target = new gfxContext(targetDT);
target->SetMatrix(matrixAutoSaveRestore.Matrix() * gfxMatrix::Translation(-drawRect.TopLeft()));
// Compose all mask-images onto maskSurface.
// Generate mask surface.
uint32_t flags = aBuilder->GetBackgroundPaintFlags() |
nsCSSRendering::PAINTBG_MASK_IMAGE;
nsRenderingContext rc(target);
@ -596,7 +584,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
maskTransform = Matrix::Translation(drawRect.x, drawRect.y) * mat;
}
if (hasMaskToDraw && !maskSurface) {
if ((svgMaskFrame || hasValidLayers) && !maskSurface) {
// Entire surface is clipped out.
aContext.Restore();
return;
@ -636,7 +624,8 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
}
}
if (opacity != 1.0f || hasMaskToDraw || (clipPathFrame && !isTrivialClip)) {
if (opacity != 1.0f || svgMaskFrame || hasValidLayers ||
(clipPathFrame && !isTrivialClip)) {
target->PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, opacity, maskSurface, maskTransform);
}
}
@ -680,7 +669,8 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
return;
}
if (opacity != 1.0f || hasMaskToDraw || (clipPathFrame && !isTrivialClip)) {
if (opacity != 1.0f || svgMaskFrame || hasValidLayers ||
(clipPathFrame && !isTrivialClip)) {
target->PopGroupAndBlend();
}