Bug 1389010, part 1 - Rename allBordersSame to allBordersSameStyle to distinguish it from the other similar variables. r=dholbert
authorJonathan Watt <jwatt@jwatt.org>
Mon, 07 Aug 2017 10:08:12 +0100
changeset 375330 dfcc8657b7253a448d02a22eea8a49f19bd56000
parent 375329 a70656b32be56bd48e54d5f4bba258d3694158d0
child 375331 68f0c27b410163aeb5dbc952383e361699ab4173
push id32355
push userkwierso@gmail.com
push dateThu, 17 Aug 2017 23:17:14 +0000
treeherdermozilla-central@a6a1f5c1d971 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1389010
milestone57.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 1389010, part 1 - Rename allBordersSame to allBordersSameStyle to distinguish it from the other similar variables. r=dholbert Also moves the declaration of tlBordersSame and brBordersSame to where they're used. MozReview-Commit-ID: 4l9pVnWT6UH
layout/painting/nsCSSRenderingBorders.cpp
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3190,22 +3190,19 @@ nsCSSBorderRenderer::DrawRectangularComp
   }
 }
 
 void
 nsCSSBorderRenderer::DrawBorders()
 {
   bool forceSeparateCorners = false;
 
-  // Examine the border style to figure out if we can draw it in one
-  // go or not.
-  bool tlBordersSame = AreBorderSideFinalStylesSame(eSideBitsTop | eSideBitsLeft);
-  bool brBordersSame = AreBorderSideFinalStylesSame(eSideBitsBottom | eSideBitsRight);
-  bool allBordersSame = AreBorderSideFinalStylesSame(eSideBitsAll);
-  if (allBordersSame &&
+  bool allBordersSameStyle = AreBorderSideFinalStylesSame(eSideBitsAll);
+
+  if (allBordersSameStyle &&
       ((mCompositeColors[0] == nullptr &&
        (mBorderStyles[0] == NS_STYLE_BORDER_STYLE_NONE ||
         mBorderStyles[0] == NS_STYLE_BORDER_STYLE_HIDDEN ||
         mBorderColors[0] == NS_RGBA(0,0,0,0))) ||
        (mCompositeColors[0] &&
         (mCompositeColors[0]->mColor == NS_RGBA(0,0,0,0) &&
          !mCompositeColors[0]->mNext))))
   {
@@ -3256,31 +3253,31 @@ nsCSSBorderRenderer::DrawBorders()
   ColorPattern color(ToDeviceColor(mBorderColors[eSideTop]));
   StrokeOptions strokeOptions(mBorderWidths[eSideTop]); // stroke width
 
   bool allBordersSolid;
 
   // First there's a couple of 'special cases' that have specifically optimized
   // drawing paths, when none of these can be used we move on to the generalized
   // border drawing code.
-  if (allBordersSame &&
+  if (allBordersSameStyle &&
       mCompositeColors[0] == nullptr &&
       allBordersSameWidth &&
       mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID &&
       mNoBorderRadius &&
       !mAvoidStroke)
   {
     // Very simple case.
     Rect rect = mOuterRect;
     rect.Deflate(mBorderWidths[0] / 2.0);
     mDrawTarget->StrokeRect(rect, color, strokeOptions);
     return;
   }
 
-  if (allBordersSame &&
+  if (allBordersSameStyle &&
       mCompositeColors[0] == nullptr &&
       mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID &&
       !mAvoidStroke &&
       !mNoBorderRadius)
   {
     // Relatively simple case.
     gfxRect outerRect = ThebesRect(mOuterRect);
     RoundedRect borderInnerRect(outerRect, mBorderRadii);
@@ -3337,17 +3334,17 @@ nsCSSBorderRenderer::DrawBorders()
     // Easy enough to deal with.
     DrawRectangularCompositeColors();
     return;
   }
 
   // If we have composite colors -and- border radius,
   // then use separate corners so we get OP_ADD for the corners.
   // Otherwise, we'll get artifacts as we draw stacked 1px-wide curves.
-  if (allBordersSame && mCompositeColors[0] != nullptr && !mNoBorderRadius)
+  if (allBordersSameStyle && mCompositeColors[0] != nullptr && !mNoBorderRadius)
     forceSeparateCorners = true;
 
   PrintAsString(" mOuterRect: "); PrintAsString(mOuterRect); PrintAsStringNewline();
   PrintAsString(" mInnerRect: "); PrintAsString(mInnerRect); PrintAsStringNewline();
   PrintAsFormatString(" mBorderColors: 0x%08x 0x%08x 0x%08x 0x%08x\n", mBorderColors[0], mBorderColors[1], mBorderColors[2], mBorderColors[3]);
 
   // if conditioning the outside rect failed, then bail -- the outside
   // rect is supposed to enclose the entire border
@@ -3367,24 +3364,24 @@ nsCSSBorderRenderer::DrawBorders()
 
   NS_FOR_CSS_SIDES(i) {
     uint8_t style = mBorderStyles[i];
     if (style == NS_STYLE_BORDER_STYLE_DASHED ||
         style == NS_STYLE_BORDER_STYLE_DOTTED)
     {
       // pretend that all borders aren't the same; we need to draw
       // things separately for dashed/dotting
-      allBordersSame = false;
+      allBordersSameStyle = false;
       dashedSides |= (1 << i);
     }
   }
 
-  PrintAsFormatString(" allBordersSame: %d dashedSides: 0x%02x\n", allBordersSame, dashedSides);
-
-  if (allBordersSame && !forceSeparateCorners) {
+  PrintAsFormatString(" allBordersSameStyle: %d dashedSides: 0x%02x\n", allBordersSameStyle, dashedSides);
+
+  if (allBordersSameStyle && !forceSeparateCorners) {
     /* Draw everything in one go */
     DrawBorderSides(eSideBitsAll);
     PrintAsStringNewline("---------------- (1)");
   } else {
     AUTO_PROFILER_LABEL("nsCSSBorderRenderer::DrawBorders:multipass", GRAPHICS);
 
     /* We have more than one pass to go.  Draw the corners separately from the sides. */
 
@@ -3532,22 +3529,28 @@ nsCSSBorderRenderer::DrawBorders()
     // We need to check for mNoBorderRadius, because when there is
     // one, FillSolidBorder always draws the full rounded rectangle
     // and expects there to be a clip in place.
     int alreadyDrawnSides = 0;
     if (mOneUnitBorder &&
         mNoBorderRadius &&
         (dashedSides & (eSideBitsTop | eSideBitsLeft)) == 0)
     {
-      if (tlBordersSame) {
+      bool tlBordersSameStyle = AreBorderSideFinalStylesSame(eSideBitsTop |
+                                                             eSideBitsLeft);
+      bool brBordersSameStyle = AreBorderSideFinalStylesSame(eSideBitsBottom |
+                                                             eSideBitsRight);
+
+      if (tlBordersSameStyle) {
         DrawBorderSides(eSideBitsTop | eSideBitsLeft);
         alreadyDrawnSides |= (eSideBitsTop | eSideBitsLeft);
       }
 
-      if (brBordersSame && (dashedSides & (eSideBitsBottom | eSideBitsRight)) == 0) {
+      if (brBordersSameStyle &&
+          (dashedSides & (eSideBitsBottom | eSideBitsRight)) == 0) {
         DrawBorderSides(eSideBitsBottom | eSideBitsRight);
         alreadyDrawnSides |= (eSideBitsBottom | eSideBitsRight);
       }
     }
 
     // We're done with the corners, now draw the sides.
     NS_FOR_CSS_SIDES (side) {
       // if we drew it above, skip it