Bug 1342302 - Part 1. Implement RectCornerRadii::IsEmpty. r=mstange
authorcku <cku@mozilla.com>
Fri, 24 Feb 2017 14:30:19 +0800
changeset 344877 14fd552c865b6492e84a8a71ede89e534c529b10
parent 344876 bd232d46a3967a174a399d4cf444b99391bd8014
child 344878 f4ac43e3f67db80ac8a10fe00eb247c028ce7d4b
push id37971
push usercku@mozilla.com
push dateSat, 25 Feb 2017 10:25:03 +0000
treeherderautoland@1b8511b2ca4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1342302
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1342302 - Part 1. Implement RectCornerRadii::IsEmpty. r=mstange 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;