[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

bdakin at apple.com bdakin at apple.com
Thu Apr 8 00:30:39 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 0acca2bfe691a924e89a245b30eb237fc84708d6
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 10 06:07:25 2009 +0000

    WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG property
    -webkit-shadow should apply shadow on the result after compositing
    -and corresponding-
    <rdar://problem/7389404>
    
    Reviewed by Oliver Hunt.
    
    Set a transparency layer when setting a shadow to apply the shadow
    to the composite.
    * rendering/SVGRenderSupport.cpp:
    (WebCore::SVGRenderBase::prepareToRenderSVGContent):
    (WebCore::SVGRenderBase::finishRenderSVGContent):
    
    LayoutTests: Tests for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG
    property -webkit-shadow should apply shadow on the result after
    compositing
    -and corresponding-
    <rdar://problem/7389404>
    
    Reviewed by Oliver Hunt.
    
    New tests:
    * platform/mac/svg/css/composite-shadow-example-expected.checksum: Added.
    * platform/mac/svg/css/composite-shadow-example-expected.png: Added.
    * platform/mac/svg/css/composite-shadow-example-expected.txt: Added.
    * platform/mac/svg/css/composite-shadow-with-opacity-expected.checksum: Added.
    * platform/mac/svg/css/composite-shadow-with-opacity-expected.png: Added.
    * platform/mac/svg/css/composite-shadow-with-opacity-expected.txt: Added.
    * svg/css/composite-shadow-example.html: Added.
    * svg/css/composite-shadow-with-opacity.html: Added.
    
    New and improved results:
    * platform/mac/svg/css/group-with-shadow-expected.checksum:
    * platform/mac/svg/css/group-with-shadow-expected.png:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51936 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 206bf7d..1cbf79e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,27 @@
+2009-12-09  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Tests for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG 
+        property -webkit-shadow should apply shadow on the result after 
+        compositing
+        -and corresponding-
+        <rdar://problem/7389404>
+
+        New tests:
+        * platform/mac/svg/css/composite-shadow-example-expected.checksum: Added.
+        * platform/mac/svg/css/composite-shadow-example-expected.png: Added.
+        * platform/mac/svg/css/composite-shadow-example-expected.txt: Added.
+        * platform/mac/svg/css/composite-shadow-with-opacity-expected.checksum: Added.
+        * platform/mac/svg/css/composite-shadow-with-opacity-expected.png: Added.
+        * platform/mac/svg/css/composite-shadow-with-opacity-expected.txt: Added.
+        * svg/css/composite-shadow-example.html: Added.
+        * svg/css/composite-shadow-with-opacity.html: Added.
+
+        New and improved results:
+        * platform/mac/svg/css/group-with-shadow-expected.checksum:
+        * platform/mac/svg/css/group-with-shadow-expected.png:
+
 2009-12-09  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.checksum b/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.checksum
new file mode 100644
index 0000000..fc6cf22
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.checksum
@@ -0,0 +1 @@
+be39bd35e1282e7ca01c801769692a4c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.png b/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.png
new file mode 100644
index 0000000..cfac77b
Binary files /dev/null and b/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.txt b/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.txt
new file mode 100644
index 0000000..8a7ce55
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/css/composite-shadow-example-expected.txt
@@ -0,0 +1,12 @@
+layer at (0,0) size 785x616
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x616
+  RenderBlock {HTML} at (0,0) size 785x616
+    RenderBody {BODY} at (8,8) size 769x600
+      RenderSVGRoot {svg} at (40.19,36.70) size 413.43x128.98
+        RenderSVGContainer {g} at (40.19,36.70) size 135.62x128.98
+          RenderPath {path} at (40.19,36.70) size 135.62x128.98 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00]}] [fill={[type=SOLID] [color=#999999]}] [data="M0.00,30.00 L-35.27,48.54 L-28.53,9.27 L-57.06,-18.54 L-17.63,-24.27 L-0.00,-60.00 L17.63,-24.27 L57.06,-18.54 L28.53,9.27 L35.27,48.54 Z"]
+        RenderSVGContainer {g} at (200.68,46.49) size 117.09x113.83
+          RenderPath {path} at (200.68,46.49) size 117.09x113.83 [transform={m=((1.00,0.00)(0.00,1.00)) t=(250.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00] [dash array={20.00}]}] [fill={[type=SOLID] [color=#999999]}] [data="M0.00,30.00 L-35.27,48.54 L-28.53,9.27 L-57.06,-18.54 L-17.63,-24.27 L-0.00,-60.00 L17.63,-24.27 L57.06,-18.54 L28.53,9.27 L35.27,48.54 Z"]
+        RenderSVGContainer {g} at (349.70,46.70) size 103.91x110.89
+          RenderPath {path} at (349.70,46.70) size 103.91x110.89 [transform={m=((1.00,0.00)(0.00,1.00)) t=(400.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00] [dash array={20.00}]}] [fill={[type=SOLID] [color=#999999]}] [data="M0.00,25.00 L-29.39,40.45 L-23.78,7.73 L-47.55,-15.45 L-14.69,-20.23 L-0.00,-50.00 L14.69,-20.23 L47.55,-15.45 L23.78,7.73 L29.39,40.45 Z"]
diff --git a/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.checksum b/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.checksum
new file mode 100644
index 0000000..78a549e
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.checksum
@@ -0,0 +1 @@
+3125bf5888684c47c32978f509421c8a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.png b/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.png
new file mode 100644
index 0000000..27f95c6
Binary files /dev/null and b/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.txt b/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.txt
new file mode 100644
index 0000000..bf030fc
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/css/composite-shadow-with-opacity-expected.txt
@@ -0,0 +1,13 @@
+layer at (0,0) size 785x616
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x616
+  RenderBlock {HTML} at (0,0) size 785x616
+    RenderBody {BODY} at (8,8) size 769x600
+layer at (8,8) size 769x600
+  RenderSVGRoot {svg} at (40.19,36.70) size 413.43x128.98 [opacity=0.50]
+    RenderSVGContainer {g} at (40.19,36.70) size 135.62x128.98
+      RenderPath {path} at (40.19,36.70) size 135.62x128.98 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00]}] [fill={[type=SOLID] [color=#999999]}] [data="M0.00,30.00 L-35.27,48.54 L-28.53,9.27 L-57.06,-18.54 L-17.63,-24.27 L-0.00,-60.00 L17.63,-24.27 L57.06,-18.54 L28.53,9.27 L35.27,48.54 Z"]
+    RenderSVGContainer {g} at (200.68,46.49) size 117.09x113.83
+      RenderPath {path} at (200.68,46.49) size 117.09x113.83 [transform={m=((1.00,0.00)(0.00,1.00)) t=(250.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00] [dash array={20.00}]}] [fill={[type=SOLID] [color=#999999]}] [data="M0.00,30.00 L-35.27,48.54 L-28.53,9.27 L-57.06,-18.54 L-17.63,-24.27 L-0.00,-60.00 L17.63,-24.27 L57.06,-18.54 L28.53,9.27 L35.27,48.54 Z"]
+    RenderSVGContainer {g} at (349.70,46.70) size 103.91x110.89
+      RenderPath {path} at (349.70,46.70) size 103.91x110.89 [transform={m=((1.00,0.00)(0.00,1.00)) t=(400.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00] [dash array={20.00}]}] [fill={[type=SOLID] [color=#999999]}] [data="M0.00,25.00 L-29.39,40.45 L-23.78,7.73 L-47.55,-15.45 L-14.69,-20.23 L-0.00,-50.00 L14.69,-20.23 L47.55,-15.45 L23.78,7.73 L29.39,40.45 Z"]
diff --git a/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.checksum b/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.checksum
index 5a71d9c..53f69d0 100644
--- a/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.checksum
+++ b/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.checksum
@@ -1 +1 @@
-915c514b7855960a76c51e341db9fad5
\ No newline at end of file
+e5d60085cfba0f14938ea6a9f8b5d989
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.png b/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.png
index 237bedf..ccd64cd 100644
Binary files a/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.png and b/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.png differ
diff --git a/LayoutTests/svg/css/composite-shadow-example.html b/LayoutTests/svg/css/composite-shadow-example.html
new file mode 100644
index 0000000..d6373b7
--- /dev/null
+++ b/LayoutTests/svg/css/composite-shadow-example.html
@@ -0,0 +1,86 @@
+<html>
+<head>
+<script language="javascript">
+<!--
+
+SVG_NS = 'http://www.w3.org/2000/svg';
+
+function pathFromStar (radius, innerRadius, sides) {
+    var path = [];
+    for (var i = 0; i < sides * 2; ++i) {
+        var theta = Math.PI * i / sides + (Math.PI / 2);
+        var r = (i % 2) ? radius : innerRadius;
+        var x = r * Math.cos(theta);
+        var y = r * Math.sin(theta);
+        path.push((i ? 'L' : 'M'), x, y);
+    }
+    path.push('Z');
+    return path.join(' ');
+}
+
+function newSvgElement (tagName, parentNode, attrs) {
+    var node = document.createElementNS(SVG_NS, tagName);
+    if (attrs) {
+        for (var k in attrs) {
+            node.setAttribute(k, attrs[k]);
+        }
+    }
+    if (parentNode) {
+        parentNode.appendChild(node);
+    }
+    return node;
+}
+
+function setCenterPosition (node, x, y) {
+    node.setAttribute('transform', 'translate($1, $2)'
+        .replace('$1', x)
+        .replace('$2', y));
+}
+
+var armed = null;
+
+window.addEventListener('load', function () {
+
+    var svgContainer = newSvgElement('svg', document.body);
+    var shapes = [
+        { pos: [ 100, 100 ], size: 60, hasStroke: false },
+        { pos: [ 250, 100 ], size: 60, hasStroke: true },
+        { pos: [ 400, 100 ], size: 50, hasStroke: true }
+    ];
+    svgContainer.style.WebkitShadow = '5px 5px 5px red';
+    for (var i = 0; i < shapes.length; ++i) {
+        var shape = shapes[i];
+        var group = newSvgElement('g', svgContainer);
+        var node = newSvgElement('path', group, {
+            d: pathFromStar(shape.size, shape.size / 2, 5),
+            fill: '#999',
+            stroke: 'black',
+            'stroke-width': 10,
+        });
+        setCenterPosition(node, shape.pos[0], shape.pos[1]);
+        if (shapes[i].hasStroke) {
+            node.setAttribute('stroke-dasharray', 20);
+        }
+        node.addEventListener('mousedown', function (ev) {
+            var e = ev || event;
+            armed = { node: e.target || e.srcElement };
+        });
+        node.addEventListener('mouseup', function () {
+            armed = null;
+        });
+    }
+    window.addEventListener('mousemove', function (ev) {
+        if (armed) {
+            var e = ev || event;
+            setCenterPosition(armed.node, e.clientX, e.clientY);
+        }
+    });
+});
+
+//-->
+</script>
+</head>
+<body>
+
+</body>
+</html>
diff --git a/LayoutTests/svg/css/composite-shadow-with-opacity.html b/LayoutTests/svg/css/composite-shadow-with-opacity.html
new file mode 100644
index 0000000..8db2102
--- /dev/null
+++ b/LayoutTests/svg/css/composite-shadow-with-opacity.html
@@ -0,0 +1,87 @@
+<html>
+<head>
+<script language="javascript">
+<!--
+
+SVG_NS = 'http://www.w3.org/2000/svg';
+
+function pathFromStar (radius, innerRadius, sides) {
+    var path = [];
+    for (var i = 0; i < sides * 2; ++i) {
+        var theta = Math.PI * i / sides + (Math.PI / 2);
+        var r = (i % 2) ? radius : innerRadius;
+        var x = r * Math.cos(theta);
+        var y = r * Math.sin(theta);
+        path.push((i ? 'L' : 'M'), x, y);
+    }
+    path.push('Z');
+    return path.join(' ');
+}
+
+function newSvgElement (tagName, parentNode, attrs) {
+    var node = document.createElementNS(SVG_NS, tagName);
+    if (attrs) {
+        for (var k in attrs) {
+            node.setAttribute(k, attrs[k]);
+        }
+    }
+    if (parentNode) {
+        parentNode.appendChild(node);
+    }
+    return node;
+}
+
+function setCenterPosition (node, x, y) {
+    node.setAttribute('transform', 'translate($1, $2)'
+        .replace('$1', x)
+        .replace('$2', y));
+}
+
+var armed = null;
+
+window.addEventListener('load', function () {
+
+    var svgContainer = newSvgElement('svg', document.body);
+    var shapes = [
+        { pos: [ 100, 100 ], size: 60, hasStroke: false },
+        { pos: [ 250, 100 ], size: 60, hasStroke: true },
+        { pos: [ 400, 100 ], size: 50, hasStroke: true }
+    ];
+    svgContainer.style.WebkitShadow = '5px 5px 5px red';
+    svgContainer.style.opacity = '0.5';
+    for (var i = 0; i < shapes.length; ++i) {
+        var shape = shapes[i];
+        var group = newSvgElement('g', svgContainer);
+        var node = newSvgElement('path', group, {
+            d: pathFromStar(shape.size, shape.size / 2, 5),
+            fill: '#999',
+            stroke: 'black',
+            'stroke-width': 10,
+        });
+        setCenterPosition(node, shape.pos[0], shape.pos[1]);
+        if (shapes[i].hasStroke) {
+            node.setAttribute('stroke-dasharray', 20);
+        }
+        node.addEventListener('mousedown', function (ev) {
+            var e = ev || event;
+            armed = { node: e.target || e.srcElement };
+        });
+        node.addEventListener('mouseup', function () {
+            armed = null;
+        });
+    }
+    window.addEventListener('mousemove', function (ev) {
+        if (armed) {
+            var e = ev || event;
+            setCenterPosition(armed.node, e.clientX, e.clientY);
+        }
+    });
+});
+
+//-->
+</script>
+</head>
+<body>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d7260db..2bc4b1f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-12-09  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG property 
+        -webkit-shadow should apply shadow on the result after compositing
+        -and corresponding-
+        <rdar://problem/7389404>
+
+        Set a transparency layer when setting a shadow to apply the shadow 
+        to the composite.
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderBase::prepareToRenderSVGContent):
+        (WebCore::SVGRenderBase::finishRenderSVGContent):
+
 2009-12-09  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 99a990c..a594410 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -94,8 +94,17 @@ void SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject
         paintInfo.context->beginTransparencyLayer(opacity);
     }
 
-    if (ShadowData* shadow = svgStyle->shadow())
-        paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color, style->colorSpace()); 
+    if (ShadowData* shadow = svgStyle->shadow()) {
+        int xShift = shadow->x < 0 ? shadow->x : 0;
+        int yShift = shadow->y < 0 ? shadow->y :0;
+        int widthShift = shadow->x < 0 ? 0 : shadow->x;
+        int heightShift = shadow->y < 0 ? 0 : shadow->y;
+        FloatRect shadowRect = FloatRect(boundingBox.x() + xShift, boundingBox.y() + yShift,
+            boundingBox.width() + widthShift, boundingBox.height() + heightShift);
+        paintInfo.context->clip(enclosingIntRect(shadowRect));
+        paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color, style->colorSpace());
+        paintInfo.context->beginTransparencyLayer(1.0f);
+    }
 
 #if ENABLE(FILTERS)
     AtomicString filterId(svgStyle->filter());
@@ -163,6 +172,11 @@ void SVGRenderBase::finishRenderSVGContent(RenderObject* object, RenderObject::P
     float opacity = style->opacity();    
     if (opacity < 1.0f)
         paintInfo.context->endTransparencyLayer();
+
+    // This needs to be done separately from opacity, because if both properties are set,
+    // then the transparency layers are nested. 
+    if (style->svgStyle()->shadow())
+        paintInfo.context->endTransparencyLayer();
 }
 
 void renderSubtreeToImage(ImageBuffer* image, RenderObject* item)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list