Title: [100045] trunk
Revision
100045
Author
[email protected]
Date
2011-11-11 16:30:05 -0800 (Fri, 11 Nov 2011)

Log Message

clipPath does not work on foreignObject
https://bugs.webkit.org/show_bug.cgi?id=68251

Patch by Florin Malita <[email protected]> on 2011-11-11
Reviewed by Dirk Schulze.

Source/WebCore:

Add ForeignObject clipping, filtering and masking support using the SVGRenderSupport helpers
(prepareToRenderSVGContent, finishRenderSVGContent) on RenderSVGForeignObject's paint path.
This also allows us to remove explicit transparency handling, since the helpers already cover it.

Tests: svg/foreignObject/clip.html
       svg/foreignObject/filter.html
       svg/foreignObject/mask.html

* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::paint):
* rendering/svg/SVGResources.cpp:
(WebCore::clipperFilterMaskerTags):

LayoutTests:

* svg/foreignObject/clip-expected.png: Added.
* svg/foreignObject/clip-expected.txt: Added.
* svg/foreignObject/clip.html: Added.
* svg/foreignObject/filter-expected.png: Added.
* svg/foreignObject/filter-expected.txt: Added.
* svg/foreignObject/filter.html: Added.
* svg/foreignObject/mask-expected.png: Added.
* svg/foreignObject/mask-expected.txt: Added.
* svg/foreignObject/mask.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (100044 => 100045)


--- trunk/LayoutTests/ChangeLog	2011-11-12 00:07:11 UTC (rev 100044)
+++ trunk/LayoutTests/ChangeLog	2011-11-12 00:30:05 UTC (rev 100045)
@@ -1,3 +1,20 @@
+2011-11-11  Florin Malita  <[email protected]>
+
+        clipPath does not work on foreignObject
+        https://bugs.webkit.org/show_bug.cgi?id=68251
+
+        Reviewed by Dirk Schulze.
+
+        * svg/foreignObject/clip-expected.png: Added.
+        * svg/foreignObject/clip-expected.txt: Added.
+        * svg/foreignObject/clip.html: Added.
+        * svg/foreignObject/filter-expected.png: Added.
+        * svg/foreignObject/filter-expected.txt: Added.
+        * svg/foreignObject/filter.html: Added.
+        * svg/foreignObject/mask-expected.png: Added.
+        * svg/foreignObject/mask-expected.txt: Added.
+        * svg/foreignObject/mask.html: Added.
+
 2011-11-11  Ojan Vafai  <[email protected]>
 
         Revert http://trac.webkit.org/changeset/100008.

Added: trunk/LayoutTests/svg/foreignObject/clip-expected.png (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/clip-expected.png	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/clip-expected.png	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,6 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksum752d12a23d69603982b7b7242e99b3b4x\xFF
+\xB6IDATx\x9C\xED\xD8\xC1	!A\xBDƵs\xAF\x89Af*\xC8s\xC9\xDCg\xA8\xAD\xB1nO\x80k\xBE\xDB^#\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b 6\xCF9\xB77<ŃX1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81\xFBƏ
+\xA9\xE1WO=IEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/svg/foreignObject/clip-expected.txt (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/clip-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/clip-expected.txt	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (0,0) size 800x600
+      RenderSVGRoot {svg} at (0,0) size 200x100
+        RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+          RenderSVGResourceClipper {clipPath} [id="clip"] [clipPathUnits=userSpaceOnUse]
+            RenderSVGPath {rect} at (0,0) size 200x50 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=200.00] [height=50.00]
+        RenderSVGForeignObject {foreignObject} at (0,0) size 200x100
+          RenderBlock {DIV} at (0,0) size 200x50 [bgcolor=#00FF00]
+            RenderText {#text} at (0,0) size 4x19
+              text run at (0,0) width 4: " "
+          RenderBlock {DIV} at (0,50) size 200x50 [bgcolor=#FF0000]
+            RenderText {#text} at (0,0) size 4x19
+              text run at (0,0) width 4: " "
+      RenderText {#text} at (0,0) size 0x0

Added: trunk/LayoutTests/svg/foreignObject/clip.html (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/clip.html	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/clip.html	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,20 @@
+<html>
+<body style="margin: 0;">
+<svg xmlns="http://www.w3.org/2000/svg">
+<!-- The FO should be clipped with only the green half visible. -->
+<defs>
+<clipPath id="clip">
+    <rect width="200" height="50"/>
+</clipPath>
+</defs>
+<foreignObject width="200" height="100" clip-path="url(#clip)" opacity=".5">
+    <html xmlns="http://www.w3.org/1999/xhtml">
+    <body style="dmargin: 0;">
+        <div style="background: #00ff00; height: 50px;">&nbsp;</div>
+        <div style="background: red; height: 50px;">&nbsp;</div>
+    </body>
+    </html>
+</foreignObject>
+</svg>
+</body>
+</html>

Added: trunk/LayoutTests/svg/foreignObject/filter-expected.png (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/filter-expected.png	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/filter-expected.png	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,6 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksum752d12a23d69603982b7b7242e99b3b4x\xFF
+\xB6IDATx\x9C\xED\xD8\xC1	!A\xBDƵs\xAF\x89Af*\xC8s\xC9\xDCg\xA8\xAD\xB1nO\x80k\xBE\xDB^#\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b 6\xCF9\xB77<ŃX1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81\xFBƏ
+\xA9\xE1WO=IEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/svg/foreignObject/filter-expected.txt (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/filter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/filter-expected.txt	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (0,0) size 800x600
+      RenderSVGRoot {svg} at (0,0) size 200x100
+        RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+          RenderSVGResourceFilter {filter} [id="filter"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 1.00 1.00 0.00 0.00 0.00 1.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [SourceGraphic]
+        RenderSVGForeignObject {foreignObject} at (0,0) size 200x100
+          RenderBlock {DIV} at (0,0) size 200x50 [bgcolor=#00FF00]
+            RenderText {#text} at (0,0) size 4x19
+              text run at (0,0) width 4: " "
+          RenderBlock {DIV} at (0,50) size 200x50 [bgcolor=#FF0000]
+            RenderText {#text} at (0,0) size 4x19
+              text run at (0,0) width 4: " "
+      RenderText {#text} at (0,0) size 0x0

Added: trunk/LayoutTests/svg/foreignObject/filter.html (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/filter.html	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/filter.html	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,20 @@
+<html>
+<body style="margin: 0;">
+<svg xmlns="http://www.w3.org/2000/svg">
+<!-- The FO's red half should be filtered to white, with only the green half visible. -->
+<defs>
+<filter id="filter" width="200" height="10">
+    <feColorMatrix type="matrix" values="1,0,0,0,0, 1,1,0,0,0, 1,0,1,0,0, 0,0,0,1,0"/>
+</filter>
+</defs>
+<foreignObject width="200" height="100" filter="url(#filter)" opacity=".5">
+    <html xmlns="http://www.w3.org/1999/xhtml">
+    <body style="dmargin: 0;">
+        <div style="background: #00ff00; height: 50px;">&nbsp;</div>
+        <div style="background: #ff0000; height: 50px;">&nbsp;</div>
+    </body>
+    </html>
+</foreignObject>
+</svg>
+</body>
+</html>

Added: trunk/LayoutTests/svg/foreignObject/mask-expected.png (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/mask-expected.png	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/mask-expected.png	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,6 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksum752d12a23d69603982b7b7242e99b3b4x\xFF
+\xB6IDATx\x9C\xED\xD8\xC1	!A\xBDƵs\xAF\x89Af*\xC8s\xC9\xDCg\xA8\xAD\xB1nO\x80k\xBE\xDB^#\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b 6\xCF9\xB77<ŃX1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81\xFBƏ
+\xA9\xE1WO=IEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/svg/foreignObject/mask-expected.txt (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/mask-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/mask-expected.txt	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (0,0) size 800x600
+      RenderSVGRoot {svg} at (0,0) size 200x100
+        RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+          RenderSVGResourceMasker {mask} [id="mask"] [maskUnits=objectBoundingBox] [maskContentUnits=userSpaceOnUse]
+            RenderSVGPath {rect} at (0,0) size 200x50 [fill={[type=SOLID] [color=#FFFFFF]}] [x=0.00] [y=0.00] [width=200.00] [height=50.00]
+        RenderSVGForeignObject {foreignObject} at (0,0) size 200x100
+          RenderBlock {DIV} at (0,0) size 200x50 [bgcolor=#00FF00]
+            RenderText {#text} at (0,0) size 4x19
+              text run at (0,0) width 4: " "
+          RenderBlock {DIV} at (0,50) size 200x50 [bgcolor=#FF0000]
+            RenderText {#text} at (0,0) size 4x19
+              text run at (0,0) width 4: " "
+      RenderText {#text} at (0,0) size 0x0

Added: trunk/LayoutTests/svg/foreignObject/mask.html (0 => 100045)


--- trunk/LayoutTests/svg/foreignObject/mask.html	                        (rev 0)
+++ trunk/LayoutTests/svg/foreignObject/mask.html	2011-11-12 00:30:05 UTC (rev 100045)
@@ -0,0 +1,20 @@
+<html>
+<body style="margin: 0;">
+<svg xmlns="http://www.w3.org/2000/svg">
+<!-- The FO should be masked, with only the green half visible. -->
+<defs>
+<mask id="mask" width="200" height="100">
+    <rect width="200" height="50" style="fill: #fff"/>
+</mask>
+</defs>
+<foreignObject width="200" height="100" mask="url(#mask)" opacity=".5">
+    <html xmlns="http://www.w3.org/1999/xhtml">
+    <body style="dmargin: 0;">
+        <div style="background: #00ff00; height: 50px;">&nbsp;</div>
+        <div style="background: red; height: 50px;">&nbsp;</div>
+    </body>
+    </html>
+</foreignObject>
+</svg>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (100044 => 100045)


--- trunk/Source/WebCore/ChangeLog	2011-11-12 00:07:11 UTC (rev 100044)
+++ trunk/Source/WebCore/ChangeLog	2011-11-12 00:30:05 UTC (rev 100045)
@@ -1,3 +1,23 @@
+2011-11-11  Florin Malita  <[email protected]>
+
+        clipPath does not work on foreignObject
+        https://bugs.webkit.org/show_bug.cgi?id=68251
+
+        Reviewed by Dirk Schulze.
+
+        Add ForeignObject clipping, filtering and masking support using the SVGRenderSupport helpers
+        (prepareToRenderSVGContent, finishRenderSVGContent) on RenderSVGForeignObject's paint path.
+        This also allows us to remove explicit transparency handling, since the helpers already cover it.
+
+        Tests: svg/foreignObject/clip.html
+               svg/foreignObject/filter.html
+               svg/foreignObject/mask.html
+
+        * rendering/svg/RenderSVGForeignObject.cpp:
+        (WebCore::RenderSVGForeignObject::paint):
+        * rendering/svg/SVGResources.cpp:
+        (WebCore::clipperFilterMaskerTags):
+
 2011-11-11  Adam Klein  <[email protected]>
 
         Remove no-op StorageNamespace::unlock method

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (100044 => 100045)


--- trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp	2011-11-12 00:07:11 UTC (rev 100044)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp	2011-11-12 00:30:05 UTC (rev 100045)
@@ -58,29 +58,31 @@
     if (SVGRenderSupport::isOverflowHidden(this))
         childPaintInfo.context->clip(m_viewport);
 
-    float opacity = style()->opacity();
-    if (opacity < 1.0f)
-        childPaintInfo.context->beginTransparencyLayer(opacity);
+    bool continueRendering = true;
+    if (paintInfo.phase == PaintPhaseForeground)
+        continueRendering = SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo);
 
-    // Paint all phases of FO elements atomically, as though the FO element established its
-    // own stacking context.
-    bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
-    LayoutPoint childPoint = IntPoint();
-    childPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
-    RenderBlock::paint(childPaintInfo, IntPoint());
-    if (!preservePhase) {
-        childPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
-        RenderBlock::paint(childPaintInfo, childPoint);
-        childPaintInfo.phase = PaintPhaseFloat;
-        RenderBlock::paint(childPaintInfo, childPoint);
-        childPaintInfo.phase = PaintPhaseForeground;
-        RenderBlock::paint(childPaintInfo, childPoint);
-        childPaintInfo.phase = PaintPhaseOutline;
-        RenderBlock::paint(childPaintInfo, childPoint);
+    if (continueRendering) {
+        // Paint all phases of FO elements atomically, as though the FO element established its
+        // own stacking context.
+        bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
+        LayoutPoint childPoint = IntPoint();
+        childPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
+        RenderBlock::paint(childPaintInfo, IntPoint());
+        if (!preservePhase) {
+            childPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
+            RenderBlock::paint(childPaintInfo, childPoint);
+            childPaintInfo.phase = PaintPhaseFloat;
+            RenderBlock::paint(childPaintInfo, childPoint);
+            childPaintInfo.phase = PaintPhaseForeground;
+            RenderBlock::paint(childPaintInfo, childPoint);
+            childPaintInfo.phase = PaintPhaseOutline;
+            RenderBlock::paint(childPaintInfo, childPoint);
+        }
     }
 
-    if (opacity < 1.0f)
-        childPaintInfo.context->endTransparencyLayer();
+    if (paintInfo.phase == PaintPhaseForeground)
+        SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, paintInfo.context);
 }
 
 LayoutRect RenderSVGForeignObject::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const

Modified: trunk/Source/WebCore/rendering/svg/SVGResources.cpp (100044 => 100045)


--- trunk/Source/WebCore/rendering/svg/SVGResources.cpp	2011-11-12 00:07:11 UTC (rev 100044)
+++ trunk/Source/WebCore/rendering/svg/SVGResources.cpp	2011-11-12 00:30:05 UTC (rev 100045)
@@ -81,6 +81,10 @@
         s_tagList.add(SVGNames::trefTag.localName().impl());
         s_tagList.add(SVGNames::tspanTag.localName().impl());
 
+        // Not listed in the definitions is the foreignObject element, but clip-path
+        // is a supported attribute.
+        s_tagList.add(SVGNames::foreignObjectTag.localName().impl());
+
         // Elements that we ignore, as it doesn't make any sense.
         // defs, pattern, switch (FIXME: Mail SVG WG about these)
         // symbol (is converted to a svg element, when referenced by use, we can safely ignore it.)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to