[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

commit-queue at webkit.org commit-queue at webkit.org
Fri Jan 21 15:00:41 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 13b196e5213023693cd3419a133a5316db5149cd
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 6 06:11:02 2011 +0000

    2011-01-05  Helder Correia  <helder at sencha.com>
    
            Reviewed by Simon Fraser.
    
            Shadows are not drawn when filling a rect with a gradient fillStyle on Mac and Chromium-Mac
            https://bugs.webkit.org/show_bug.cgi?id=51869
    
            GraphicsContext::fillRect(const FloatRect&) is clipping to the rect.
            The shadow is being drawn, but getting clipped to the rect being filled.
            The solution is to draw the gradient into a CGLayer (when a shadow is
            required), then render the layer to the GraphicsContext.
    
            This patch also fixes:
            canvas/philip/tests/2d.shadow.gradient.alpha.html
            canvas/philip/tests/2d.shadow.gradient.basic.html
            canvas/philip/tests/2d.shadow.gradient.transparent.2.html
    
            New test to ensure that shadows are drawn when fillStyle is a gradient,
            possibly with some transparency and blur, and specifically using
            fillRect.
    
            * fast/canvas/canvas-fillRect-gradient-shadow-expected.txt: Added.
            * fast/canvas/canvas-fillRect-gradient-shadow.html: Added.
            * fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js: Added.
    2011-01-05  Helder Correia  <helder at sencha.com>
    
            Reviewed by Simon Fraser.
    
            Shadows are not drawn when filling a rect with a gradient fillStyle on Mac and Chromium-Mac
            https://bugs.webkit.org/show_bug.cgi?id=51869
    
            GraphicsContext::fillRect(const FloatRect&) is clipping to the rect.
            The shadow is being drawn, but getting clipped to the rect being filled.
            The solution is to draw the gradient into a CGLayer (when a shadow is
            required), then render the layer to the GraphicsContext.
    
            This patch also fixes:
            canvas/philip/tests/2d.shadow.gradient.alpha.html
            canvas/philip/tests/2d.shadow.gradient.basic.html
            canvas/philip/tests/2d.shadow.gradient.transparent.2.html
    
            Test: fast/canvas/canvas-fillRect-gradient-shadow.html
    
            * platform/graphics/Gradient.h:
            * platform/graphics/cg/GradientCG.cpp:
            (WebCore::Gradient::paint):
            * platform/graphics/cg/GraphicsContextCG.cpp:
            (WebCore::GraphicsContext::fillRect):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75139 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e30dd24..b06d767 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-05  Helder Correia  <helder at sencha.com>
+
+        Reviewed by Simon Fraser.
+
+        Shadows are not drawn when filling a rect with a gradient fillStyle on Mac and Chromium-Mac
+        https://bugs.webkit.org/show_bug.cgi?id=51869
+
+        GraphicsContext::fillRect(const FloatRect&) is clipping to the rect.
+        The shadow is being drawn, but getting clipped to the rect being filled.
+        The solution is to draw the gradient into a CGLayer (when a shadow is
+        required), then render the layer to the GraphicsContext.
+
+        This patch also fixes:
+        canvas/philip/tests/2d.shadow.gradient.alpha.html
+        canvas/philip/tests/2d.shadow.gradient.basic.html
+        canvas/philip/tests/2d.shadow.gradient.transparent.2.html
+
+        New test to ensure that shadows are drawn when fillStyle is a gradient,
+        possibly with some transparency and blur, and specifically using
+        fillRect.
+
+        * fast/canvas/canvas-fillRect-gradient-shadow-expected.txt: Added.
+        * fast/canvas/canvas-fillRect-gradient-shadow.html: Added.
+        * fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js: Added.
+
 2011-01-05  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Ariya Hidayat.
diff --git a/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow-expected.txt b/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow-expected.txt
new file mode 100644
index 0000000..2f04697
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow-expected.txt
@@ -0,0 +1,89 @@
+Ensure correct behavior of canvas with fillRect using a gradient fillStyle and a shadow
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is around 76
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is around 76
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is around 76
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is around 76
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 25
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 25
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 25
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 25
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 10
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 10
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 10
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 10
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 15
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 15
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 15
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is smaller than 15
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow.html b/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow.html
new file mode 100644
index 0000000..247665d
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/canvas-fillRect-gradient-shadow.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js b/LayoutTests/fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js
new file mode 100644
index 0000000..552a737
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js
@@ -0,0 +1,199 @@
+description("Ensure correct behavior of canvas with fillRect using a gradient fillStyle and a shadow");
+
+function print(message, color)
+{
+    var paragraph = document.createElement("div");
+    paragraph.appendChild(document.createTextNode(message));
+    paragraph.style.fontFamily = "monospace";
+    if (color)
+        paragraph.style.color = color;
+    document.getElementById("console").appendChild(paragraph);
+}
+
+function shouldBeAround(a, b)
+{
+    var evalA;
+    try {
+        evalA = eval(a);
+    } catch(e) {
+        evalA = e;
+    }
+
+    if (Math.abs(evalA - b) < 5)
+        print("PASS " + a + " is around " + b , "green")
+    else
+        print("FAIL " + a + " is not around " + b + " (actual: " + evalA + ")", "red");
+}
+
+function shouldBeSmaller(a, b)
+{
+    var evalA;
+    try {
+        evalA = eval(a);
+    } catch(e) {
+        evalA = e;
+    }
+
+    if (evalA < b)
+        print("PASS " + a + " is smaller than " + b , "green")
+    else
+        print("FAIL " + a + " is not smaller than " + b + " (actual: " + evalA + ")", "red");
+}
+
+var canvas = document.createElement('canvas');
+document.body.appendChild(canvas);
+canvas.setAttribute('width', '400');
+canvas.setAttribute('height', '800');
+var ctx = canvas.getContext('2d');
+
+var gradient = ctx.createLinearGradient(0, 0, 100, 100);
+gradient.addColorStop(0, 'rgba(0, 0, 255, 1.0)');
+gradient.addColorStop(1, 'rgba(0, 0, 255, 1.0)');
+
+ctx.shadowOffsetX = 200;
+ctx.fillStyle = gradient;
+
+ctx.shadowColor = 'rgba(255, 0, 0, 1.0)';
+ctx.fillRect(50, 50, 100, 100);
+
+ctx.shadowColor = 'rgba(255, 0, 0, 0.3)';
+ctx.fillRect(50, 200, 100, 100);
+
+ctx.shadowColor = 'rgba(255, 0, 0, 1.0)';
+ctx.shadowBlur = 5;
+ctx.fillRect(50, 350, 100, 100);
+
+ctx.shadowColor = 'rgba(255, 0, 0, 0.3)';
+ctx.fillRect(50, 500, 100, 100);
+
+ctx.rotate(Math.PI/2);
+ctx.fillRect(650, -150, 100, 100);
+
+var d; // imageData.data
+
+// Verify solid shadow.
+d = ctx.getImageData(250, 50, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBe('d[3]', '255');
+
+d = ctx.getImageData(250, 149, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBe('d[3]', '255');
+
+d = ctx.getImageData(349, 50, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBe('d[3]', '255');
+
+d = ctx.getImageData(349, 149, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBe('d[3]', '255');
+
+// Verify solid alpha shadow.
+d = ctx.getImageData(250, 200, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeAround('d[3]', '76');
+
+d = ctx.getImageData(250, 299, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeAround('d[3]', '76');
+
+d = ctx.getImageData(349, 200, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeAround('d[3]', '76');
+
+d = ctx.getImageData(349, 299, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeAround('d[3]', '76');
+
+// Verify blurry shadow.
+d = ctx.getImageData(248, 348, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '25');
+
+d = ctx.getImageData(248, 451, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '25');
+
+d = ctx.getImageData(351, 348, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '25');
+
+d = ctx.getImageData(351, 451, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '25');
+
+// Verify blurry alpha shadow.
+d = ctx.getImageData(248, 498, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '10');
+
+d = ctx.getImageData(248, 601, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '10');
+
+d = ctx.getImageData(351, 498, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '10');
+
+d = ctx.getImageData(351, 601, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '10');
+
+// Verify blurry alpha shadow with rotation.
+d = ctx.getImageData(249, 649, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '15');
+
+d = ctx.getImageData(248, 751, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '15');
+
+d = ctx.getImageData(350, 649, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '15');
+
+d = ctx.getImageData(351, 751, 1, 1).data;
+shouldBe('d[0]', '255');
+shouldBe('d[1]', '0');
+shouldBe('d[2]', '0');
+shouldBeSmaller('d[3]', '15');
+
+var successfullyParsed = true;
diff --git a/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.alpha-expected.txt b/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.alpha-expected.txt
deleted file mode 100644
index c16691b..0000000
--- a/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.alpha-expected.txt
+++ /dev/null
@@ -1 +0,0 @@
-Failed assertion: got pixel [255,0,0,255] at (50,25), expected [127,0,127,255] +/- 2
diff --git a/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.basic-expected.txt b/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.basic-expected.txt
deleted file mode 100644
index e3a7124..0000000
--- a/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.basic-expected.txt
+++ /dev/null
@@ -1 +0,0 @@
-Failed assertion: got pixel [255,0,0,255] at (50,25), expected [0,255,0,255]
diff --git a/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.transparent.2-expected.txt b/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.transparent.2-expected.txt
deleted file mode 100644
index 12430ae..0000000
--- a/LayoutTests/platform/mac-snowleopard/canvas/philip/tests/2d.shadow.gradient.transparent.2-expected.txt
+++ /dev/null
@@ -1 +0,0 @@
-Failed assertion: got pixel [255,0,0,255] at (25,25), expected [0,255,0,255]
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dd09679..4049950 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-05  Helder Correia  <helder at sencha.com>
+
+        Reviewed by Simon Fraser.
+
+        Shadows are not drawn when filling a rect with a gradient fillStyle on Mac and Chromium-Mac
+        https://bugs.webkit.org/show_bug.cgi?id=51869
+
+        GraphicsContext::fillRect(const FloatRect&) is clipping to the rect.
+        The shadow is being drawn, but getting clipped to the rect being filled.
+        The solution is to draw the gradient into a CGLayer (when a shadow is
+        required), then render the layer to the GraphicsContext.
+
+        This patch also fixes:
+        canvas/philip/tests/2d.shadow.gradient.alpha.html
+        canvas/philip/tests/2d.shadow.gradient.basic.html
+        canvas/philip/tests/2d.shadow.gradient.transparent.2.html
+
+        Test: fast/canvas/canvas-fillRect-gradient-shadow.html
+
+        * platform/graphics/Gradient.h:
+        * platform/graphics/cg/GradientCG.cpp:
+        (WebCore::Gradient::paint):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::fillRect):
+
 2011-01-05  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/Gradient.h b/WebCore/platform/graphics/Gradient.h
index 19b9c6a..4d5cdc6 100644
--- a/WebCore/platform/graphics/Gradient.h
+++ b/WebCore/platform/graphics/Gradient.h
@@ -35,6 +35,10 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
 
+#if PLATFORM(WIN)
+#include <CoreGraphics/CoreGraphics.h>
+#endif
+
 #if PLATFORM(CG)
 
 #define USE_CG_SHADING defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD)
@@ -136,6 +140,7 @@ namespace WebCore {
         void setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation);
 
 #if PLATFORM(CG)
+        void paint(CGContextRef);
         void paint(GraphicsContext*);
 #endif
     private:
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index 96a92fb..434d35b 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -148,6 +148,12 @@ void GraphicsContext::clearShadow()
     clearPlatformShadow();
 }
 
+bool GraphicsContext::hasShadow() const
+{
+    return m_state.shadowColor.isValid() && m_state.shadowColor.alpha()
+           && (m_state.shadowBlur || m_state.shadowOffset.width() || m_state.shadowOffset.height());
+}
+
 bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color, ColorSpace& colorSpace) const
 {
     offset = m_state.shadowOffset;
@@ -155,7 +161,7 @@ bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color, Co
     color = m_state.shadowColor;
     colorSpace = m_state.shadowColorSpace;
 
-    return color.isValid() && color.alpha() && (blur || offset.width() || offset.height());
+    return hasShadow();
 }
 
 float GraphicsContext::strokeThickness() const
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index a4a2695..3c5cdad 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -346,6 +346,7 @@ namespace WebCore {
         void beginTransparencyLayer(float opacity);
         void endTransparencyLayer();
 
+        bool hasShadow() const;
         void setShadow(const FloatSize&, float blur, const Color&, ColorSpace);
         bool getShadow(FloatSize&, float&, Color&, ColorSpace&) const;
         void clearShadow();
diff --git a/WebCore/platform/graphics/cg/GradientCG.cpp b/WebCore/platform/graphics/cg/GradientCG.cpp
index 21495b9..974dd6b 100644
--- a/WebCore/platform/graphics/cg/GradientCG.cpp
+++ b/WebCore/platform/graphics/cg/GradientCG.cpp
@@ -112,28 +112,33 @@ void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
 void Gradient::paint(GraphicsContext* context)
 {
     CGContextRef ctx = context->platformContext();
+    paint(ctx);
+}
+
+void Gradient::paint(CGContextRef context)
+{
 #if USE_CG_SHADING
-    CGContextDrawShading(ctx, platformGradient());
+    CGContextDrawShading(context, platformGradient());
 #else
     CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation;
     if (m_radial) {
         bool needScaling = aspectRatio() != 1;
         if (needScaling) {
-            CGContextSaveGState(ctx);
+            CGContextSaveGState(context);
             // Scale from the center of the gradient. We only ever scale non-deprecated gradients,
             // for which m_p0 == m_p1.
             ASSERT(m_p0 == m_p1);
-            CGContextTranslateCTM(ctx, m_p0.x(), m_p0.y());
-            CGContextScaleCTM(ctx, 1, 1 / aspectRatio());
-            CGContextTranslateCTM(ctx, -m_p0.x(), -m_p0.y());
+            CGContextTranslateCTM(context, m_p0.x(), m_p0.y());
+            CGContextScaleCTM(context, 1, 1 / aspectRatio());
+            CGContextTranslateCTM(context, -m_p0.x(), -m_p0.y());
         }
 
-        CGContextDrawRadialGradient(ctx, platformGradient(), m_p0, m_r0, m_p1, m_r1, extendOptions);
-        
+        CGContextDrawRadialGradient(context, platformGradient(), m_p0, m_r0, m_p1, m_r1, extendOptions);
+
         if (needScaling)
-            CGContextRestoreGState(ctx);
+            CGContextRestoreGState(context);
     } else
-        CGContextDrawLinearGradient(ctx, platformGradient(), m_p0, m_p1, extendOptions);
+        CGContextDrawLinearGradient(context, platformGradient(), m_p0, m_p1, extendOptions);
 #endif
 }
 
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 7898d62..0c22f1f 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -601,9 +601,17 @@ void GraphicsContext::fillRect(const FloatRect& rect)
 
     if (m_state.fillGradient) {
         CGContextSaveGState(context);
-        CGContextClipToRect(context, rect);
         CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
-        m_state.fillGradient->paint(this);
+        if (hasShadow()) {
+            CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(rect.width(), rect.height()), 0);
+            CGContextRef layerContext = CGLayerGetContext(layer);
+            m_state.fillGradient->paint(layerContext);
+            CGContextDrawLayerAtPoint(context, CGPointMake(rect.left(), rect.top()), layer);
+            CGLayerRelease(layer);
+        } else {
+            CGContextClipToRect(context, rect);
+            m_state.fillGradient->paint(this);
+        }
         CGContextRestoreGState(context);
         return;
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list