Bug 1345853 - Part 2. If the transform matrix is singular, return DrawResult::SUCCESS, instead of DrawResult::BAD_ARGS r=tnikkel

According to bug 1345853 comment 5, tn said:
You probably want to return whatever was drawn there regardless of the
DrawResult. SVGMaskFrame has the same problem. Keep in mind that DrawResult is
only reporting on how drawing of any images went, not the drawing of anything
else. Also looking over the patches from bug 1258510 I see a couple places where
BAD_ARGS is returned if the transform matrix is singular. We would want to
return SUCCESS in that case I think, because we drew what we were instructed to
draw.

MozReview-Commit-ID: 5XcDuKQwXTJ

--HG--
extra : rebase_source : 5c558d469148e0cb3cfe9365aed1a4a65c572532
This commit is contained in:
cku 2017-03-16 12:06:36 +08:00
Родитель 148bb081ca
Коммит 251e635682
6 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -289,7 +289,7 @@ SVGGeometryFrame::PaintSVG(gfxContext& aContext,
gfxMatrix newMatrix =
aContext.CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers();
if (newMatrix.IsSingular()) {
return DrawResult::BAD_ARGS;
return DrawResult::SUCCESS;
}
uint32_t paintOrder = StyleSVG()->mPaintOrder;

Просмотреть файл

@ -3595,7 +3595,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
if (aTransform.IsSingular()) {
NS_WARNING("Can't render text element!");
return DrawResult::BAD_ARGS;
return DrawResult::SUCCESS;
}
gfxMatrix matrixForPaintServers = aTransform * initialMatrix;

Просмотреть файл

@ -221,7 +221,7 @@ nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
if (aTransform.IsSingular()) {
NS_WARNING("Can't render foreignObject element!");
return DrawResult::BAD_ARGS;
return DrawResult::SUCCESS;
}
nsRect kidDirtyRect = kid->GetVisualOverflowRect();

Просмотреть файл

@ -272,7 +272,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
gfxMatrix patternMatrix = GetGradientTransform(aSource, aOverrideBounds);
if (patternMatrix.IsSingular()) {
return MakePair(DrawResult::BAD_ARGS, RefPtr<gfxPattern>());
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
// revert any vector effect transform so that the gradient appears unchanged
@ -284,7 +284,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
}
if (!patternMatrix.Invert()) {
return MakePair(DrawResult::BAD_ARGS, RefPtr<gfxPattern>());
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
RefPtr<gfxPattern> gradient = CreateGradient();

Просмотреть файл

@ -321,7 +321,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
// Moz2D transforms in the opposite direction to Thebes
if (!maskSurfaceMatrix.Invert()) {
return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr<SourceSurface>());
return MakePair(DrawResult::SUCCESS, RefPtr<SourceSurface>());
}
*aParams.maskTransform = ToMatrix(maskSurfaceMatrix);

Просмотреть файл

@ -282,7 +282,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
gfxMatrix ctm = ConstructCTM(viewBox, patternContentUnits, patternUnits,
callerBBox, aContextMatrix, aSource);
if (ctm.IsSingular()) {
return MakePair(DrawResult::BAD_ARGS, RefPtr<SourceSurface>());
return MakePair(DrawResult::SUCCESS, RefPtr<SourceSurface>());
}
if (patternWithChildren->mCTM) {
@ -309,7 +309,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
patternTransform *= ToMatrix(userToOuterSVG);
if (patternTransform.IsSingular()) {
NS_WARNING("Singular matrix painting non-scaling-stroke");
return MakePair(DrawResult::BAD_ARGS, RefPtr<SourceSurface>());
return MakePair(DrawResult::SUCCESS, RefPtr<SourceSurface>());
}
}
}
@ -319,7 +319,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
*patternMatrix = GetPatternMatrix(patternUnits, patternTransform,
bbox, callerBBox, aContextMatrix);
if (patternMatrix->IsSingular()) {
return MakePair(DrawResult::BAD_ARGS, RefPtr<SourceSurface>());
return MakePair(DrawResult::SUCCESS, RefPtr<SourceSurface>());
}
// Now that we have all of the necessary geometries, we can