Bug 1213545. Carry x,y offsets with inset box shadows. r=mstange
authorMason Chang <mchang@mozilla.com>
Mon, 19 Oct 2015 10:53:04 -0700
changeset 303562 2965de9363e93a226aebb3b3f16bcaece5753984
parent 303561 736f0981762cfd629a57f94a3f5c982979919c05
child 303563 5f2853528bbf4859ca122e944243cf596144283d
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1213545
milestone44.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 1213545. Carry x,y offsets with inset box shadows. r=mstange
gfx/thebes/gfxBlur.cpp
gfx/thebes/gfxBlur.h
layout/base/nsCSSRendering.cpp
layout/base/nsCSSRendering.h
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -975,17 +975,18 @@ void
 gfxAlphaBoxBlur::BlurInsetBox(gfxContext* aDestinationCtx,
                               const Rect aDestinationRect,
                               const Rect aShadowClipRect,
                               const IntSize aBlurRadius,
                               const IntSize aSpreadRadius,
                               const Color& aShadowColor,
                               bool aHasBorderRadius,
                               const RectCornerRadii& aInnerClipRadii,
-                              const Rect aSkipRect)
+                              const Rect aSkipRect,
+                              const Point aShadowOffset)
 {
   // Blur inset shadows ALWAYS have a 0 spread radius.
   if ((aBlurRadius.width <= 0 && aBlurRadius.height <= 0)) {
     FillDestinationPath(aDestinationCtx, aDestinationRect, aShadowClipRect,
         aShadowColor, aHasBorderRadius, aInnerClipRadii);
     return;
   }
 
@@ -1000,16 +1001,17 @@ gfxAlphaBoxBlur::BlurInsetBox(gfxContext
     return;
   }
 
   Rect srcOuter(Point(), Size(minInsetBlur->GetSize()));
   Rect srcInner = srcOuter;
   srcInner.Deflate(Margin(slice));
 
   Rect dstOuter(aDestinationRect);
+  dstOuter.MoveBy(aShadowOffset);
   dstOuter.Inflate(Margin(extendDest));
   Rect dstInner = dstOuter;
   dstInner.Deflate(Margin(slice));
 
   DrawTarget* destDrawTarget = aDestinationCtx->GetDrawTarget();
   if (srcOuter.IsEqualInterior(srcInner)) {
     destDrawTarget->DrawSurface(minInsetBlur, dstOuter, srcOuter);
   } else {
--- a/gfx/thebes/gfxBlur.h
+++ b/gfx/thebes/gfxBlur.h
@@ -155,17 +155,18 @@ public:
     void BlurInsetBox(gfxContext* aDestinationCtx,
                       const mozilla::gfx::Rect aDestinationRect,
                       const mozilla::gfx::Rect aShadowClipRect,
                       const mozilla::gfx::IntSize aBlurRadius,
                       const mozilla::gfx::IntSize aSpreadRadius,
                       const mozilla::gfx::Color& aShadowColor,
                       const bool aHasBorderRadius,
                       const RectCornerRadii& aInnerClipRadii,
-                      const mozilla::gfx::Rect aSkipRect);
+                      const mozilla::gfx::Rect aSkipRect,
+                      const mozilla::gfx::Point aShadowOffset);
 
 protected:
     already_AddRefed<mozilla::gfx::SourceSurface>
     GetInsetBlur(mozilla::gfx::IntMargin& aExtendDestBy,
                  mozilla::gfx::IntMargin& aSlice,
                  const mozilla::gfx::Rect aDestinationRect,
                  const mozilla::gfx::Rect aShadowClipRect,
                  const mozilla::gfx::IntSize& aBlurRadius,
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -1601,21 +1601,25 @@ nsCSSRendering::PaintBoxShadowInner(nsPr
         MakePathForRoundedRect(*drawTarget, shadowGfxRect, innerRadii);
       renderContext->Clip(roundedRect);
     } else {
       renderContext->Clip(shadowGfxRect);
     }
 
     nsContextBoxBlur insetBoxBlur;
     gfxRect destRect = nsLayoutUtils::RectToGfxRect(shadowPaintRect, twipsPerPixel);
+    Point shadowOffset(shadowItem->mXOffset / twipsPerPixel,
+                       shadowItem->mYOffset / twipsPerPixel);
+
     insetBoxBlur.InsetBoxBlur(renderContext, ToRect(destRect),
                               shadowClipGfxRect, shadowColor,
                               blurRadius, spreadDistanceAppUnits,
                               twipsPerPixel, hasBorderRadius,
-                              clipRectRadii, ToRect(skipGfxRect));
+                              clipRectRadii, ToRect(skipGfxRect),
+                              shadowOffset);
     renderContext->Restore();
   }
 }
 
 DrawResult
 nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
                                 nsRenderingContext& aRenderingContext,
                                 nsIFrame* aForFrame,
@@ -5539,17 +5543,17 @@ nsContextBoxBlur::InsetBoxBlur(gfxContex
                                Rect aDestinationRect,
                                Rect aShadowClipRect,
                                Color& aShadowColor,
                                nscoord aBlurRadiusAppUnits,
                                nscoord aSpreadDistanceAppUnits,
                                int32_t aAppUnitsPerDevPixel,
                                bool aHasBorderRadius,
                                RectCornerRadii& aInnerClipRectRadii,
-                               Rect aSkipRect)
+                               Rect aSkipRect, Point aShadowOffset)
 {
   if (aDestinationRect.IsEmpty()) {
     mContext = nullptr;
     return false;
   }
 
   IntSize blurRadius;
   IntSize spreadRadius;
@@ -5581,14 +5585,14 @@ nsContextBoxBlur::InsetBoxBlur(gfxContex
 
   {
     gfxContextAutoSaveRestore autoRestore(aDestinationCtx);
     aDestinationCtx->SetMatrix(gfxMatrix());
 
     mAlphaBoxBlur.BlurInsetBox(aDestinationCtx, transformedDestRect,
                                transformedShadowClipRect,
                                blurRadius, spreadRadius,
-                               aShadowColor,
-                               aHasBorderRadius,
-                               aInnerClipRectRadii, transformedSkipRect);
+                               aShadowColor, aHasBorderRadius,
+                               aInnerClipRectRadii, transformedSkipRect,
+                               aShadowOffset);
   }
   return true;
 }
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -977,17 +977,18 @@ public:
                     mozilla::gfx::Rect aDestinationRect,
                     mozilla::gfx::Rect aShadowClipRect,
                     mozilla::gfx::Color& aShadowColor,
                     nscoord aBlurRadiusAppUnits,
                     nscoord aSpreadRadiusAppUnits,
                     int32_t aAppUnitsPerDevPixel,
                     bool aHasBorderRadius,
                     RectCornerRadii& aInnerClipRectRadii,
-                    mozilla::gfx::Rect aSkipRect);
+                    mozilla::gfx::Rect aSkipRect,
+                    mozilla::gfx::Point aShadowOffset);
 
 protected:
   static void GetBlurAndSpreadRadius(gfxContext* aContext,
                                      int32_t aAppUnitsPerDevPixel,
                                      nscoord aBlurRadius,
                                      nscoord aSpreadRadius,
                                      mozilla::gfx::IntSize& aOutBlurRadius,
                                      mozilla::gfx::IntSize& aOutSpreadRadius,