This happens in CG and is related to bug 51869, this time to be fixed in GraphicsContext::strokeRect(const FloatRect& r, float lineWidth). We need to draw the gradient clipped to the stroke on a CGLayer first, and then draw the layer on the GraphicsContext.
Created attachment 79059 [details] Patch
Comment on attachment 79059 [details] Patch Why does this code do anything with m_state.fillGradient->gradientSpaceTransform() ?
Created attachment 79887 [details] Concat CTM with strokeGradient->gradientSpaceTransform()
Created attachment 80979 [details] Added svg/css/text-gradient-stroke-shadow.svg
Attachment 80979 [details] did not build on win: Build output: http://queues.webkit.org/results/7690217
Comment on attachment 80979 [details] Added svg/css/text-gradient-stroke-shadow.svg View in context: https://bugs.webkit.org/attachment.cgi?id=80979&action=review > LayoutTests/svg/css/text-gradient-stroke-shadow.svg:8 > +<text x="100" y="300" style="font-size: 300px; text-shadow: #000 20px 20px 20px;" stroke-width="10" stroke="url(#gradient)">SVG</text> Maybe just use a rect in these tests to avoid font differences between platforms. Why does Mac render hollow characters, but the other platforms render solid black ones? > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:972 > + const float halfLineWidth = lineWidth / 2; Can you add a comment explaining the lineWidth/2 offset? Why do it here, and not in the non-shadow path? > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1000 > > + New blank line here.
Created attachment 81121 [details] New rect-gradient-stroke-shadow.svg. Add comment for line width. Fix build.
Comment on attachment 81121 [details] New rect-gradient-stroke-shadow.svg. Add comment for line width. Fix build. View in context: https://bugs.webkit.org/attachment.cgi?id=81121&action=review > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:988 > + // Compensate for half of the line width, otherwise the layer's top-left corner would > + // be aligned with the rect's top-left corner, not considering the line width. This > + // would result in leaving half of the line out of the layer on the left and top sides. > + const float translationX = halfLineWidth - rect.x(); > + const float translationY = halfLineWidth - rect.y(); > + CGContextTranslateCTM(layerContext, translationX, translationY); > + > + CGContextAddRect(layerContext, rect); > + CGContextReplacePathWithStrokedPath(layerContext); > + CGContextClip(layerContext); > + CGContextConcatCTM(layerContext, m_state.strokeGradient->gradientSpaceTransform()); > + m_state.strokeGradient->paint(layerContext); > + > + const float destinationX = rect.x() - halfLineWidth; > + const float destinationY = rect.y() - halfLineWidth; > + CGContextDrawLayerAtPoint(context, CGPointMake(destinationX, destinationY), layer); I think you want to avoid drawing the layer at half-pixel offsets. Why not just round out the layer size to a whole pixel?
Created attachment 81165 [details] Ceil layer size and round blit destination.
Comment on attachment 81165 [details] Ceil layer size and round blit destination. View in context: https://bugs.webkit.org/attachment.cgi?id=81165&action=review > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:193 > - > + Please leave out these formatting hunks
Created attachment 83698 [details] Performance test
Created attachment 83703 [details] Remove formatting hunks
Created attachment 83912 [details] Otherwise the layer size will not be suficient to contain all pixels because of smoothing when we're scaling.
Manually committed r80515: http://trac.webkit.org/changeset/80515
Committed r114023: <http://trac.webkit.org/changeset/114023>