Bug 939607 - Part 1: Make PaintBoxShadowOuter take an opacity value. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 18 Nov 2013 22:32:09 +1300
changeset 170672 513f5fe03a0ba15bf140fe86eb8961a7e14417cc
parent 170671 4110a8986a2a7fe3ac540e9854395bd41048975b
child 170673 a64e4c44d2ef40cc432694880ab4c1bd8b5c9c82
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs939607
milestone28.0a1
Bug 939607 - Part 1: Make PaintBoxShadowOuter take an opacity value. r=roc
layout/base/nsCSSRendering.cpp
layout/base/nsCSSRendering.h
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -1015,17 +1015,18 @@ nsCSSRendering::EndFrameTreesLocked()
   }
 }
 
 void
 nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
                                     nsRenderingContext& aRenderingContext,
                                     nsIFrame* aForFrame,
                                     const nsRect& aFrameArea,
-                                    const nsRect& aDirtyRect)
+                                    const nsRect& aDirtyRect,
+                                    float aOpacity)
 {
   const nsStyleBorder* styleBorder = aForFrame->StyleBorder();
   nsCSSShadowArray* shadows = styleBorder->mBoxShadow;
   if (!shadows)
     return;
   nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1);
 
   bool hasBorderRadius;
@@ -1127,18 +1128,21 @@ nsCSSRendering::PaintBoxShadowOuter(nsPr
 
     // Set the shadow color; if not specified, use the foreground color
     nscolor shadowColor;
     if (shadowItem->mHasColor)
       shadowColor = shadowItem->mColor;
     else
       shadowColor = aForFrame->StyleColor()->mColor;
 
+    gfxRGBA gfxShadowColor(shadowColor);
+    gfxShadowColor.a *= aOpacity;
+
     renderContext->Save();
-    renderContext->SetColor(gfxRGBA(shadowColor));
+    renderContext->SetColor(gfxShadowColor);
 
     // Draw the shape of the frame so it can be blurred. Recall how nsContextBoxBlur
     // doesn't make any temporary surfaces if blur is 0 and it just returns the original
     // surface? If we have no blur, we're painting this fill on the actual content surface
     // (renderContext == shadowContext) which is why we set up the color and clip
     // before doing this.
     if (nativeTheme) {
       // We don't clip the border-box from the shadow, nor any other box.
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -259,17 +259,18 @@ struct nsCSSRendering {
                                   nsIFrame* aForFrame,
                                   const nsRect& aFrameArea,
                                   const nsRect& aDirtyRect);
 
   static void PaintBoxShadowOuter(nsPresContext* aPresContext,
                                   nsRenderingContext& aRenderingContext,
                                   nsIFrame* aForFrame,
                                   const nsRect& aFrameArea,
-                                  const nsRect& aDirtyRect);
+                                  const nsRect& aDirtyRect,
+                                  float aOpacity = 1.0);
 
   static void ComputePixelRadii(const nscoord *aAppUnitsRadii,
                                 nscoord aAppUnitsPerPixel,
                                 gfxCornerSizes *oBorderRadii);
 
   /**
    * Render the border for an element using css rendering rules
    * for borders. aSkipSides is a bitmask of the sides to skip