Bug 1342302 - Part 1. Implement RectCornerRadii::IsEmpty. draft
authorcku <cku@mozilla.com>
Fri, 24 Feb 2017 14:30:19 +0800
changeset 489595 8e17fb38e43ecb71648d7e397c37cc398d5b5715
parent 489583 f36062d04d165f6f6e781cf0633ffcbbebe6c273
child 489596 7619e4c40eba475970d51518c63db8406f5593be
push id46865
push userbmo:cku@mozilla.com
push dateSat, 25 Feb 2017 05:23:41 +0000
bugs1342302
milestone54.0a1
Bug 1342302 - Part 1. Implement RectCornerRadii::IsEmpty. MozReview-Commit-ID: JHaRg4rBHu8
gfx/2d/PathHelpers.h
layout/painting/nsCSSRendering.cpp
--- 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;