Original code: bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow(m_state) && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet. if (drawOwnShadow) { float shadowBlur = m_state.shadowsUseLegacyRadius ? radiusToLegacyRadius(m_state.shadowBlur) : m_state.shadowBlur; // Turn off CG shadows. CGContextSaveGState(context); CGContextSetShadowWithColor(context, CGSizeZero, 0, 0); ShadowBlur contextShadow(FloatSize(shadowBlur, shadowBlur), m_state.shadowOffset, m_state.shadowColor, m_state.shadowColorSpace); contextShadow.drawRectShadow(this, rect, RoundedRect::Radii()); } CGContextFillRect(context, rect); After some debugging it seems that the shadow applied twice both with ShadowBlur and CGShadow. We halved the rectangle to emphasize this effect: // Was CGContextFillRect(context, rect); FloatRect tmp2 = FloatRect(rect.x() + rect.width() / 4, rect.y() + rect.height() / 4, rect.width() / 2, rect.height() / 2); CGContextFillRect(context, tmp2); We attached two pics. In without_contextShadow.png the drawRectShadow was commented out while it was enabled on with_contextShadow.png. The strange thing was the shadow is still drawn when the drawRectShadow was commented out. Any idea?
Created attachment 108840 [details] with_contextShadow.png
Created attachment 108841 [details] without_contextShadow.png
I'm a bit confused. Where's the testcase; how can I reproduce this? Or is this in code you're currently working on? Anyway, how are you applying the shadow? -webkit-svg-shadow? If it's -webkit-svg-shadow, that gets applied via a transparency layer that gets created (in SVGRenderSupport::prepareToRenderSVGContent) whenever you first hit the -webkit-svg-shadow'd element, so each element has no need to draw its own shadow.
(In reply to comment #3) > I'm a bit confused. Where's the testcase; how can I reproduce this? Or is this in code you're currently working on? > Anyway, how are you applying the shadow? -webkit-svg-shadow? If it's -webkit-svg-shadow, that gets applied via a transparency layer that gets created (in SVGRenderSupport::prepareToRenderSVGContent) whenever you first hit the -webkit-svg-shadow'd element, so each element has no need to draw its own shadow. The test case was a reduced version of svg/css/group-with-shadow.svg. It uses -webkit-svg-shadow property. I faced this problem while I was working on a new renderer for SVGElements which painted with the shape's own painter without path's one. So if I tried to fill a rectangle with the platform dependent fillRect() it applied both of the shadows.
Why is SVG different from CSS here? CSS doesn't have this issue.
(In reply to comment #5) > Why is SVG different from CSS here? CSS doesn't have this issue. I don't know exactly the reason but it seems that doesn't matter if I turn out the shadow drawing it still will be painted. I guess it maybe related to context redirections...
rene, could you upload a test case please? Is this still the case?
Still need a testcase.
It's difficult to confirm this bug without a test case. We don't believe there is an ongoing issue here. If you do feel there is a problem, please REOPEN this bug and include a test case illustrating the issue.