2011-01-25 Helder Correia <helder@sencha.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jan 2011 18:54:30 +0000 (18:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jan 2011 18:54:30 +0000 (18:54 +0000)
        Reviewed by Dirk Schulze.

        REGRESSION(75139): SVG gradients are not applied to texts
        https://bugs.webkit.org/show_bug.cgi?id=52531

        CGContextConcatCTM should use the CGLayer context, not the
        GraphicsContext. Also, the CTM needs to be adjusted (translated).
        This fixes SVG text gradient fill.

        Test: svg/css/composite-shadow-text.svg

        * platform/graphics/cg/GraphicsContextCG.cpp:
        (WebCore::GraphicsContext::fillRect):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76612 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

index bb2c9c4c9376056d60641b3d3066748c09345dc1..71adaabd7b97483bf00220886bbce582b4c1ad38 100644 (file)
@@ -1,3 +1,19 @@
+2011-01-25  Helder Correia  <helder@sencha.com>
+
+        Reviewed by Dirk Schulze.
+
+        REGRESSION(75139): SVG gradients are not applied to texts
+        https://bugs.webkit.org/show_bug.cgi?id=52531
+
+        CGContextConcatCTM should use the CGLayer context, not the
+        GraphicsContext. Also, the CTM needs to be adjusted (translated).
+        This fixes SVG text gradient fill.
+
+        Test: svg/css/composite-shadow-text.svg
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::fillRect):
+
 2011-01-25  Benjamin Kalman  <kalman@chromium.org>
 
         Reviewed by Ryosuke Niwa.
index bcfc37b56b476802a805e4fd42b5922c1a983758..61425698e557988853ed3e298dde786e1d45644f 100644 (file)
@@ -626,9 +626,14 @@ void GraphicsContext::fillRect(const FloatRect& rect)
     if (m_state.fillGradient) {
         CGContextSaveGState(context);
         if (hasShadow()) {
-            CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
             CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(rect.width(), rect.height()), 0);
             CGContextRef layerContext = CGLayerGetContext(layer);
+
+            CGContextTranslateCTM(layerContext, -rect.x(), -rect.y());
+            CGContextAddRect(layerContext, rect);
+            CGContextClip(layerContext);
+
+            CGContextConcatCTM(layerContext, m_state.fillGradient->gradientSpaceTransform());
             m_state.fillGradient->paint(layerContext);
             CGContextDrawLayerAtPoint(context, CGPointMake(rect.left(), rect.top()), layer);
             CGLayerRelease(layer);