Index: Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp |
=================================================================== |
--- Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp (revision 85512) |
+++ Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp (working copy) |
@@ -1047,6 +1047,7 @@ |
double blur = blurFloat; |
uint32_t mfFlags = SkBlurMaskFilter::kHighQuality_BlurFlag; |
+ SkXfermode::Mode colorMode = SkXfermode::kSrc_Mode; |
if (m_state.shadowsIgnoreTransforms) { |
// Currently only the GraphicsContext associated with the |
@@ -1055,6 +1056,12 @@ |
// with a CanvasRenderingContext. |
mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag; |
+ // CSS wants us to ignore the original's alpha, but Canvas wants us to |
+ // modulate with it. Using shadowsIgnoreTransforms to tell us that we're |
+ // in a Canvas, we change the colormode to kDst_Mode, so we don't overwrite |
+ // it with our layer's (default opaque-black) color. |
+ colorMode = SkXfermode::kDst_Mode; |
+ |
// CG uses natural orientation for Y axis, but the HTML5 canvas spec |
// does not. |
// So we now flip the height since it was flipped in |
@@ -1082,7 +1089,7 @@ |
info.fPaintBits |= SkLayerDrawLooper::kMaskFilter_Bit; // our blur |
info.fPaintBits |= SkLayerDrawLooper::kColorFilter_Bit; |
- info.fColorMode = SkXfermode::kDst_Mode; |
+ info.fColorMode = colorMode; |
info.fOffset.set(width, height); |
info.fPostTranslate = m_state.shadowsIgnoreTransforms; |