Bug 598202: Avoid drawing borders which are fully transparent. r=vlad a=vlad
authorBas Schouten <bschouten@mozilla.com>
Mon, 08 Nov 2010 22:52:02 +0100
changeset 57124 83e5fdf07535ea22d4aa2ba61a2a2449c8e7bccf
parent 57123 1a4bc45ee5b1d9f098c1958f625b008cf517cf18
child 57125 728eedc664b2c5e8fbb12156123e945675ebd0b2
push id16799
push userbschouten@mozilla.com
push dateMon, 08 Nov 2010 21:52:41 +0000
treeherdermozilla-central@83e5fdf07535 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad, vlad
bugs598202
milestone2.0b8pre
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 598202: Avoid drawing borders which are fully transparent. r=vlad a=vlad
layout/base/nsCSSRenderingBorders.cpp
--- a/layout/base/nsCSSRenderingBorders.cpp
+++ b/layout/base/nsCSSRenderingBorders.cpp
@@ -1009,25 +1009,29 @@ nsCSSBorderRenderer::DrawBorders()
   PRBool forceSeparateCorners = PR_FALSE;
 
   // Examine the border style to figure out if we can draw it in one
   // go or not.
   PRBool tlBordersSame = AreBorderSideFinalStylesSame(SIDE_BIT_TOP | SIDE_BIT_LEFT);
   PRBool brBordersSame = AreBorderSideFinalStylesSame(SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT);
   PRBool allBordersSame = AreBorderSideFinalStylesSame(SIDE_BITS_ALL);
   if (allBordersSame &&
-      mCompositeColors[0] == NULL &&
-      (mBorderStyles[0] == NS_STYLE_BORDER_STYLE_NONE ||
-       mBorderStyles[0] == NS_STYLE_BORDER_STYLE_HIDDEN ||
-       mBorderColors[0] == NS_RGBA(0,0,0,0)))
+      ((mCompositeColors[0] == NULL &&
+       (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))))
   {
     // All borders are the same style, and the style is either none or hidden, or the color
     // is transparent.
-    // This doesn't check if the composite colors happen to be all transparent, but that should
-    // happen very rarely in practice.
+    // This also checks if the first composite color is transparent, and there are
+    // no others. It doesn't check if there are subsequent transparent ones, because
+    // that would be very silly.
     return;
   }
 
   // If we have composite colors -and- border radius,
   // then use separate corners so we get OPERATOR_ADD for the corners.
   // Otherwise, we'll get artifacts as we draw stacked 1px-wide curves.
   if (allBordersSame && mCompositeColors[0] != nsnull && !mNoBorderRadius)
     forceSeparateCorners = PR_TRUE;