bug 1333749 - verify that inset box shadows are symmetric before attempting to mirror them. r=mchang

MozReview-Commit-ID: 2q3WH25PWSs
This commit is contained in:
Lee Salzman 2017-01-25 14:53:38 -05:00
parent 456dec1f00
commit f72fa46b41

View File

@ -1245,7 +1245,13 @@ gfxAlphaBoxBlur::BlurInsetBox(gfxContext* aDestinationCtx,
GetInsetBoxShadowRects(blurMargin, innerMargin, aShadowClipRect,
aDestinationRect, whitespaceRect, outerRect);
bool mirrorCorners = !aInnerClipRadii || aInnerClipRadii->AreRadiiSame();
// Check that the inset margin between the outer and whitespace rects is symmetric,
// and that all corner radii are the same, in which case the blur can be mirrored.
Margin checkMargin = outerRect - whitespaceRect;
bool mirrorCorners =
checkMargin.left == checkMargin.right &&
checkMargin.top == checkMargin.bottom &&
(!aInnerClipRadii || aInnerClipRadii->AreRadiiSame());
RefPtr<SourceSurface> minBlur =
GetInsetBlur(outerRect, whitespaceRect, useDestRect, aShadowColor,
aBlurRadius, aInnerClipRadii, destDrawTarget, mirrorCorners);