Bug 1342302 - Part 1. Implement RectCornerRadii::IsEmpty.
MozReview-Commit-ID: JHaRg4rBHu8
--- a/gfx/2d/PathHelpers.h
+++ b/gfx/2d/PathHelpers.h
@@ -242,16 +242,21 @@ struct RectCornerRadii {
const Size TopRight() const { return radii[eCornerTopRight]; }
Size& TopRight() { return radii[eCornerTopRight]; }
const Size BottomRight() const { return radii[eCornerBottomRight]; }
Size& BottomRight() { return radii[eCornerBottomRight]; }
const Size BottomLeft() const { return radii[eCornerBottomLeft]; }
Size& BottomLeft() { return radii[eCornerBottomLeft]; }
+
+ bool IsEmpty() const {
+ return TopLeft().IsEmpty() && TopRight().IsEmpty() &&
+ BottomRight().IsEmpty() && BottomLeft().IsEmpty();
+ }
};
/**
* Appends a path represending a rounded rectangle to the path being built by
* aPathBuilder.
*
* aRect The rectangle to append.
* aCornerRadii Contains the radii of the top-left, top-right, bottom-right
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -2127,17 +2127,17 @@ nsCSSRendering::GetImageLayerClip(const
if (haveRoundedCorners) {
nsIFrame::InsetBorderRadii(aClipState->mRadii, border);
}
}
if (haveRoundedCorners) {
auto d2a = aForFrame->PresContext()->AppUnitsPerDevPixel();
nsCSSRendering::ComputePixelRadii(aClipState->mRadii, d2a, &aClipState->mClippedRadii);
- aClipState->mHasRoundedCorners = true;
+ aClipState->mHasRoundedCorners = !aClipState->mClippedRadii.IsEmpty();
}
if (!haveRoundedCorners && aClipState->mHasAdditionalBGClipArea) {
// Do the intersection here to account for the fast path(?) below.
aClipState->mBGClipArea =
aClipState->mBGClipArea.Intersect(aClipState->mAdditionalBGClipArea);
aClipState->mHasAdditionalBGClipArea = false;