[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

krit at webkit.org krit at webkit.org
Wed Dec 22 14:26:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0e2b38017e75f6e3b291b3b66119505ed7abb9c1
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 8 19:40:42 2010 +0000

    2010-10-08  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG feImage needs absolute subregion for preserveAspectRatio
            https://bugs.webkit.org/show_bug.cgi?id=47409
    
            PreserverAspectRatio needs the subregion in absolute coordinates to determine
            the destination position and size of the input image. The maxEffectRect() already
            stores the absolute subregion, but clipped to the filter region.
    
            Test: svg/W3C-SVG-1.1se/filters-image-03-f.svg
    
            * platform/graphics/filters/FETile.cpp:
            (WebCore::FETile::apply):
            * platform/graphics/filters/FilterEffect.h: Added enum to differentate sourece inputs, feTile and feImage.
            (WebCore::FilterEffect::filterEffectType):
            * platform/graphics/filters/SourceAlpha.h: Make use of the new enum in FilterEffect
            (WebCore::SourceAlpha::filterEffectType):
            * platform/graphics/filters/SourceGraphic.h: Ditto.
            (WebCore::SourceGraphic::filterEffectType):
            * svg/graphics/filters/SVGFEImage.cpp: Take the absolute subregion to determine the destination rect for input image.
            (WebCore::FEImage::apply):
            * svg/graphics/filters/SVGFEImage.h: Ditto.
            (WebCore::FEImage::setAbsoluteSubregion):
            (WebCore::FEImage::filterEffectType):
            * svg/graphics/filters/SVGFilter.cpp: Give over subregion in absolute coordinates to feImage. Just feImage makes use of it.
            (WebCore::SVGFilter::determineFilterPrimitiveSubregion):
    2010-10-08  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG feImage needs absolute subregion for preserveAspectRatio
            https://bugs.webkit.org/show_bug.cgi?id=47409
    
            Adapted test form the new SVG 1.1 se test suite to check the correct behavior of feImage.
            The subregion in absolute coordinates is a FloatRect instead of an IntRect. This
            sharpens the result of svg/webarchive/svg-feimage-subresources.
    
            * platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.checksum: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt: Added.
            * platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum:
            * platform/mac/svg/webarchive/svg-feimage-subresources-expected.png:
            * svg/W3C-SVG-1.1-SE/filters-image-03-f.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69416 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b47e95b..c592605 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-10-08  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG feImage needs absolute subregion for preserveAspectRatio
+        https://bugs.webkit.org/show_bug.cgi?id=47409
+
+        Adapted test form the new SVG 1.1 se test suite to check the correct behavior of feImage.
+        The subregion in absolute coordinates is a FloatRect instead of an IntRect. This
+        sharpens the result of svg/webarchive/svg-feimage-subresources.
+
+        * platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.checksum: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt: Added.
+        * platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum:
+        * platform/mac/svg/webarchive/svg-feimage-subresources-expected.png:
+        * svg/W3C-SVG-1.1-SE/filters-image-03-f.svg: Added.
+
 2010-10-08  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze.
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.checksum b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.checksum
new file mode 100644
index 0000000..1c58a99
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.checksum
@@ -0,0 +1 @@
+1c631e9b14f34ff25a574aa369f06d22
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png
new file mode 100644
index 0000000..5385080
Binary files /dev/null and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt
new file mode 100644
index 0000000..2fc3232
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt
@@ -0,0 +1,65 @@
+layer at (0,0) size 480x360
+  RenderView at (0,0) size 480x360
+layer at (0,0) size 480x360
+  RenderSVGRoot {svg} at (0,0) size 480x360
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderSVGContainer {g} at (59,99) size 352x152
+      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+        RenderSVGResourceFilter {filter} [id="default"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="all_specified_relative"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="all_specified_absolute"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="x_specified"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="y_specified"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="width_specified"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="height_specified"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="width_height_specified"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+        RenderSVGResourceFilter {filter} [id="x_y_specified"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+          [feImage image-size="100x100"]
+      RenderSVGContainer {g} at (59,99) size 352x152 [transform={m=((1.00,0.00)(0.00,1.00)) t=(60.00,100.00)}]
+        RenderSVGPath {rect} at (60,100) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=50.00] [height=50.00]
+          [filter="default"] RenderSVGResourceFilter {filter} at (0,0) size 50x50
+        RenderSVGPath {rect} at (160,100) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=100.00] [y=0.00] [width=50.00] [height=50.00]
+          [filter="all_specified_relative"] RenderSVGResourceFilter {filter} at (100,0) size 50x50
+        RenderSVGPath {rect} at (260,100) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=200.00] [y=0.00] [width=50.00] [height=50.00]
+          [filter="all_specified_absolute"] RenderSVGResourceFilter {filter} at (200,0) size 50x50
+        RenderSVGPath {rect} at (360,100) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=300.00] [y=0.00] [width=50.00] [height=50.00]
+          [filter="y_specified"] RenderSVGResourceFilter {filter} at (300,0) size 50x50
+        RenderSVGPath {rect} at (60,200) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=100.00] [width=50.00] [height=50.00]
+          [filter="width_specified"] RenderSVGResourceFilter {filter} at (0,100) size 50x50
+        RenderSVGPath {rect} at (160,200) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=100.00] [y=100.00] [width=50.00] [height=50.00]
+          [filter="height_specified"] RenderSVGResourceFilter {filter} at (100,100) size 50x50
+        RenderSVGPath {rect} at (260,200) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=200.00] [y=100.00] [width=50.00] [height=50.00]
+          [filter="width_height_specified"] RenderSVGResourceFilter {filter} at (200,100) size 50x50
+        RenderSVGPath {rect} at (360,200) size 50x50 [fill={[type=SOLID] [color=#FF0000]}] [x=300.00] [y=100.00] [width=50.00] [height=50.00]
+          [filter="x_y_specified"] RenderSVGResourceFilter {filter} at (300,100) size 50x50
+        RenderSVGContainer {g} at (59,99) size 352x152
+          RenderSVGPath {rect} at (59,99) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=0.00] [y=0.00] [width=50.00] [height=50.00]
+          RenderSVGPath {rect} at (159,99) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=100.00] [y=0.00] [width=50.00] [height=50.00]
+          RenderSVGPath {rect} at (259,99) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=200.00] [y=0.00] [width=50.00] [height=50.00]
+          RenderSVGPath {rect} at (359,99) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=300.00] [y=0.00] [width=50.00] [height=50.00]
+          RenderSVGPath {rect} at (59,199) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=0.00] [y=100.00] [width=50.00] [height=50.00]
+          RenderSVGPath {rect} at (159,199) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=100.00] [y=100.00] [width=50.00] [height=50.00]
+          RenderSVGPath {rect} at (259,199) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=200.00] [y=100.00] [width=50.00] [height=50.00]
+          RenderSVGPath {rect} at (359,199) size 52x52 [stroke={[type=SOLID] [color=#0000FF]}] [x=300.00] [y=100.00] [width=50.00] [height=50.00]
+    RenderSVGContainer {g} at (10,314) size 223x32
+      RenderSVGText {text} at (10,314) size 223x32 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 223x32
+          chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 2 width 40.90: "$R"
+          chunk 1 text run 2 at (50.51,340.00) startOffset 2 endOffset 3 width 17.79: "e"
+          chunk 1 text run 3 at (67.82,340.00) startOffset 3 endOffset 12 width 117.38: "vision: 1"
+          chunk 1 text run 4 at (182.83,340.00) startOffset 12 endOffset 13 width 8.90: "."
+          chunk 1 text run 5 at (188.50,340.00) startOffset 13 endOffset 16 width 44.48: "1 $"
+    RenderSVGPath {rect} at (0,0) size 480x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
+    RenderSVGContainer {g} at (0,0) size 480x23
+      RenderSVGPath {rect} at (0,0) size 480x22 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FF0000]}] [x=1.00] [y=1.00] [width=478.00] [height=20.00]
+      RenderSVGText {text} at (206,1) size 68x21 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 68x21
+          chunk 1 (middle anchor) text run 1 at (206.67,18.00) startOffset 0 endOffset 5 width 66.66: "DRAFT"
diff --git a/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum b/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum
index e04a988..f6d7d54 100644
--- a/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum
+++ b/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum
@@ -1 +1 @@
-f080f575091da0c119e750b02e74b090
\ No newline at end of file
+d645c06189914812437235a8936bc83d
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.png b/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.png
index 0f703c0..6f25adb 100644
Binary files a/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.png and b/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.png differ
diff --git a/LayoutTests/svg/W3C-SVG-1.1-SE/filters-image-03-f.svg b/LayoutTests/svg/W3C-SVG-1.1-SE/filters-image-03-f.svg
new file mode 100644
index 0000000..e8a3bb2
--- /dev/null
+++ b/LayoutTests/svg/W3C-SVG-1.1-SE/filters-image-03-f.svg
@@ -0,0 +1,132 @@
+<svg id="svg-root" width="100%" height="100%"
+  viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+  <!--======================================================================-->
+  <!--=  Copyright 2008 World Wide Web Consortium, (Massachusetts          =-->
+  <!--=  Institute of Technology, European Research Consortium for         =-->
+  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
+  <!--=  All Rights Reserved.                                              =-->
+  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
+  <!--======================================================================-->
+  <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
+    template-version="1.4" reviewer="[reviewer]" author="ED" status="created"
+    version="$Revision: 1.1 $" testname="$RCSfile: filters-image-03-f.svg,v $">
+
+    <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/filters.html#feImageElement">
+      <p>
+        This tests the feImage element with a number of different filter primitive subregion values.
+      </p>
+    </d:testDescription>
+    <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        Run the test. No interaction required.
+      </p>
+    </d:operatorScript>
+
+    <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        The test is passed if:
+      </p>
+      <ul>
+        <li>the first row show four smiley faces of the same size, each framed by a blue rectangle</li>
+        <li>the first image on the left on the second row shows half a smiley face (horizontally offset)</li>
+        <li>the second image on the left on the second row shows half a smiley face (vertically offset)</li>
+
+        <li>the third image on the left on the second row shows the upper-lefthand quarter of the smiley face enlarged to fit the blue rectangle</li>
+        <li>the rightmost image on the second row shows the upper-lefthand quarter of the smiley face (horizontally and vertically offset)</li>
+      </ul>
+    </d:passCriteria>
+  </d:SVGTestCase>
+  <title id="test-title">$RCSfile: filters-image-03-f.svg,v $</title>
+  <defs>
+
+    <font-face
+      font-family="SVGFreeSansASCII"
+      unicode-range="U+0-7F">
+      <font-face-src>
+        <font-face-uri xlink:href="../custom/resources/SVGFreeSans.svg#ascii"/>
+      </font-face-src>
+    </font-face>
+  </defs>
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+    <defs>
+      <filter id="default" x="0" y="0" width="1" height="1">
+
+        <feImage xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+      <filter id="all_specified_relative" x="0" y="0" width="1" height="1">
+        <!-- x=100/480 y=0/360 width=50/480 height=50/360-->
+        <feImage x="20.8%" y="0%" width="10.4%" height="13.8%"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+      <filter id="all_specified_absolute" x="0" y="0" width="1" height="1">
+        <feImage x="200" y="0" height="50" width="50"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+
+      <filter id="x_specified" x="0" y="0" width="1" height="1">
+        <feImage x="0%"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+      <filter id="y_specified" x="0" y="0" width="1" height="1">
+        <feImage y="0%"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+      <filter id="width_specified" x="0" y="0" width="1" height="1">
+        <feImage width="20.4%"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+
+      <filter id="height_specified" x="0" y="0" width="1" height="1">
+        <feImage height="27.6%"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+      <filter id="width_height_specified" x="0" y="0" width="1" height="1">
+        <feImage width="20.8%" height="27.6%"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+      <filter id="x_y_specified" x="0" y="0" width="1" height="1">
+        <feImage x="67.7%" y="34.6%"
+           xlink:href="../W3C-SVG-1.1/resources/smiley.png"/>
+      </filter>
+
+    </defs>
+    
+    <g transform="translate(60 100)">
+      <rect fill="red" width="50" height="50" filter="url(#default)"/>
+      <rect fill="red" x="100" width="50" height="50" filter="url(#all_specified_relative)"/>
+      <rect fill="red" x="200" width="50" height="50" filter="url(#all_specified_absolute)"/>
+      <rect fill="red" x="300" width="50" height="50" filter="url(#y_specified)"/>
+      
+      <rect fill="red" y="100" width="50" height="50" filter="url(#width_specified)"/>
+      <rect fill="red" x="100" y="100" width="50" height="50" filter="url(#height_specified)"/>
+      <rect fill="red" x="200" y="100" width="50" height="50" filter="url(#width_height_specified)"/>
+
+      <rect fill="red" x="300" y="100" width="50" height="50" filter="url(#x_y_specified)"/>
+
+      <g id="reference_frames" stroke="blue" stroke-width="1" fill="none">
+        <rect width="50" height="50" />
+        <rect x="100" width="50" height="50"/>
+        <rect x="200" width="50" height="50"/>
+        <rect x="300" width="50" height="50"/>
+        <rect y="100" width="50" height="50"/>
+        <rect x="100" y="100" width="50" height="50"/>
+
+        <rect x="200" y="100" width="50" height="50"/>
+        <rect x="300" y="100" width="50" height="50"/>
+      </g>
+    </g>
+  </g>
+  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
+    <text id="revision" x="10" y="340" stroke="none"
+      fill="black">$Revision: 1.1 $</text>
+  </g>
+
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
+  <!-- comment out this watermark once the test is approved -->
+  <g id="draft-watermark">
+    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
+    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
+      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
+  </g>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e4c4566..c247652 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-10-08  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG feImage needs absolute subregion for preserveAspectRatio
+        https://bugs.webkit.org/show_bug.cgi?id=47409
+
+        PreserverAspectRatio needs the subregion in absolute coordinates to determine
+        the destination position and size of the input image. The maxEffectRect() already
+        stores the absolute subregion, but clipped to the filter region.
+
+        Test: svg/W3C-SVG-1.1se/filters-image-03-f.svg
+
+        * platform/graphics/filters/FETile.cpp:
+        (WebCore::FETile::apply):
+        * platform/graphics/filters/FilterEffect.h: Added enum to differentate sourece inputs, feTile and feImage.
+        (WebCore::FilterEffect::filterEffectType):
+        * platform/graphics/filters/SourceAlpha.h: Make use of the new enum in FilterEffect
+        (WebCore::SourceAlpha::filterEffectType):
+        * platform/graphics/filters/SourceGraphic.h: Ditto.
+        (WebCore::SourceGraphic::filterEffectType):
+        * svg/graphics/filters/SVGFEImage.cpp: Take the absolute subregion to determine the destination rect for input image.
+        (WebCore::FEImage::apply):
+        * svg/graphics/filters/SVGFEImage.h: Ditto.
+        (WebCore::FEImage::setAbsoluteSubregion):
+        (WebCore::FEImage::filterEffectType):
+        * svg/graphics/filters/SVGFilter.cpp: Give over subregion in absolute coordinates to feImage. Just feImage makes use of it.
+        (WebCore::SVGFilter::determineFilterPrimitiveSubregion):
+
 2010-10-08  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/platform/graphics/filters/FETile.cpp b/WebCore/platform/graphics/filters/FETile.cpp
index 743ce9f..598fe9e 100644
--- a/WebCore/platform/graphics/filters/FETile.cpp
+++ b/WebCore/platform/graphics/filters/FETile.cpp
@@ -69,7 +69,7 @@ void FETile::apply(Filter* filter)
     FloatRect tileRect = in->maxEffectRect();
     FloatPoint inMaxEffectLocation = tileRect.location();
     FloatPoint maxEffectLocation = maxEffectRect().location();
-    if (in->isSourceInput()) {
+    if (in->filterEffectType() == FilterEffectTypeSourceInput) {
         tileRect = filter->filterRegion();
         tileRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
     }
diff --git a/WebCore/platform/graphics/filters/FilterEffect.h b/WebCore/platform/graphics/filters/FilterEffect.h
index 9e8bb61..a614b59 100644
--- a/WebCore/platform/graphics/filters/FilterEffect.h
+++ b/WebCore/platform/graphics/filters/FilterEffect.h
@@ -39,6 +39,13 @@ namespace WebCore {
 
 typedef Vector<RefPtr<FilterEffect> > FilterEffectVector;
 
+enum FilterEffectType {
+    FilterEffectTypeUnknown,
+    FilterEffectTypeImage,
+    FilterEffectTypeTile,
+    FilterEffectTypeSourceInput
+};
+
 class FilterEffect : public RefCounted<FilterEffect> {
 public:
     virtual ~FilterEffect();
@@ -64,7 +71,7 @@ public:
 
     IntRect absolutePaintRect() const { return m_absolutePaintRect; }
     void setAbsolutePaintRect(const IntRect& absolutePaintRect) { m_absolutePaintRect = absolutePaintRect; }
-    
+
     IntRect maxEffectRect() const { return m_maxEffectRect; }
     void setMaxEffectRect(const IntRect& maxEffectRect) { m_maxEffectRect = maxEffectRect; } 
 
@@ -72,8 +79,8 @@ public:
     virtual void dump() = 0;
 
     virtual void determineAbsolutePaintRect(Filter*);
-    
-    virtual bool isSourceInput() const { return false; }
+
+    virtual FilterEffectType filterEffectType() const { return FilterEffectTypeUnknown; }
 
     virtual TextStream& externalRepresentation(TextStream&, int indention = 0) const;
 
diff --git a/WebCore/platform/graphics/filters/SourceAlpha.h b/WebCore/platform/graphics/filters/SourceAlpha.h
index 2c249e6..83704e5 100644
--- a/WebCore/platform/graphics/filters/SourceAlpha.h
+++ b/WebCore/platform/graphics/filters/SourceAlpha.h
@@ -39,7 +39,7 @@ public:
 
     virtual void determineAbsolutePaintRect(Filter*);
 
-    virtual bool isSourceInput() const { return true; }
+    virtual FilterEffectType filterEffectType() const { return FilterEffectTypeSourceInput; }
 
     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
 
diff --git a/WebCore/platform/graphics/filters/SourceGraphic.h b/WebCore/platform/graphics/filters/SourceGraphic.h
index 1816373..a13337d 100644
--- a/WebCore/platform/graphics/filters/SourceGraphic.h
+++ b/WebCore/platform/graphics/filters/SourceGraphic.h
@@ -40,7 +40,7 @@ public:
 
     virtual void determineAbsolutePaintRect(Filter*);
 
-    virtual bool isSourceInput() const { return true; }
+    virtual FilterEffectType filterEffectType() const { return FilterEffectTypeSourceInput; }
 
     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
 
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp
index d7edc38..b9e7d75 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp
@@ -54,9 +54,10 @@ void FEImage::apply(Filter* filter)
         return;
 
     FloatRect srcRect(FloatPoint(), m_image->size());
-    FloatRect destRect(FloatPoint(), absolutePaintRect().size());
+    FloatRect destRect(m_absoluteSubregion);
 
     m_preserveAspectRatio.transformRect(destRect, srcRect);
+    destRect.move(-m_absoluteSubregion.x(), -m_absoluteSubregion.y());
 
     filterContext->drawImage(m_image.get(), DeviceColorSpace, destRect, srcRect);
 }
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.h b/WebCore/svg/graphics/filters/SVGFEImage.h
index 7cd971b..4fe90f7 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.h
+++ b/WebCore/svg/graphics/filters/SVGFEImage.h
@@ -33,11 +33,15 @@ class FEImage : public FilterEffect {
 public:
     static PassRefPtr<FEImage> create(RefPtr<Image>, const SVGPreserveAspectRatio&);
 
+    void setAbsoluteSubregion(const FloatRect& absoluteSubregion) { m_absoluteSubregion = absoluteSubregion; }
+
     virtual void apply(Filter*);
     virtual void dump();
 
     virtual void determineAbsolutePaintRect(Filter*) { setAbsolutePaintRect(maxEffectRect()); }
 
+    virtual FilterEffectType filterEffectType() const { return FilterEffectTypeImage; }
+
     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     
 private:
@@ -45,6 +49,7 @@ private:
 
     RefPtr<Image> m_image;
     SVGPreserveAspectRatio m_preserveAspectRatio;
+    FloatRect m_absoluteSubregion;
 };
 
 } // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFilter.cpp b/WebCore/svg/graphics/filters/SVGFilter.cpp
index 2b16ad4..dfdccd7 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.cpp
+++ b/WebCore/svg/graphics/filters/SVGFilter.cpp
@@ -23,6 +23,8 @@
 #if ENABLE(SVG) && ENABLE(FILTERS)
 #include "SVGFilter.h"
 
+#include "SVGFEImage.h"
+
 namespace WebCore {
 
 SVGFilter::SVGFilter(const AffineTransform& absoluteTransform, const FloatRect& absoluteSourceDrawingRegion, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode)
@@ -69,9 +71,6 @@ void SVGFilter::determineFilterPrimitiveSubregion(FilterEffect* effect, const Fl
             newSubRegion.setHeight(unionOfPreviousPrimitiveSubregions.height());
     }
 
-    // clip every filter effect to the filter region
-    newSubRegion.intersect(m_filterRegion);
-
     effect->setFilterPrimitiveSubregion(newSubRegion);
     // TODO: Everything above should be moved to a first phase of layout in RenderSVGResourceFilterPrimitive.
     // The scaling of the subregion to the repaint rect should be merged with a more intelligent repaint logic
@@ -79,8 +78,21 @@ void SVGFilter::determineFilterPrimitiveSubregion(FilterEffect* effect, const Fl
     // See bug https://bugs.webkit.org/show_bug.cgi?id=45614.
     newSubRegion = m_absoluteTransform.mapRect(newSubRegion);
     newSubRegion.scale(filterResolution().width(), filterResolution().height());
+
+    // FEImage needs the unclipped subregion in absolute coordinates to determine the correct
+    // destination rect in combination with preserveAspectRatio.
+    if (effect->filterEffectType() == FilterEffectTypeImage) {
+        FEImage* imageEffect = static_cast<FEImage*>(effect);
+        imageEffect->setAbsoluteSubregion(newSubRegion);
+    }
+
+    // Clip every filter effect to the filter region.
+    FloatRect absoluteScaledFilterRegion = m_absoluteFilterRegion;
+    absoluteScaledFilterRegion.scale(filterResolution().width(), filterResolution().height());
+    newSubRegion.intersect(absoluteScaledFilterRegion);
+
     effect->setMaxEffectRect(enclosingIntRect(newSubRegion));
-    if (!effect->isSourceInput())
+    if (effect->filterEffectType() != FilterEffectTypeSourceInput)
         m_maxImageSize = m_maxImageSize.expandedTo(newSubRegion.size()); 
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list